how can i achieve that a non mandatory attribute that is used to create the api response gives the atribite with an empty list instead of not showing the attribute at all?


to fill the json resonse of a rest api i use a structure.

part of this structure is a list type. this list type attribute was mandatory, but i changed it to not mandatroy to implement a filter that makes is possible to not show the list attribute.

now i get the beaviour that the list attribute is also not show in the output when the filter paramter wants me to show the attribute, but the list is empty. i want to show this in the output so the caller of the api knows the difference between, dont give me attribite at all or the attribute was checked but is empty.

i want this output:in the response

"other attribute " : "hallo",

"the attribute that is now not mandatory" : [ ] ,

"other attribute 2" : "hallo 2"

i get this output in the repsonse

"other attribute " : "hallo",

"other attribute 2" : "hallo 2"

Hi Sven,

I assume you are exposing a REST API.

Select the REST API and set the Send Default Values property to Yes (highlighted in yellow below).

This will serialize all values of the response structure, instead of only the values that have been set.

I hope this helps!

Kind regards,


Hallo Stuart, 

thanks for your quick response!

because of your response I can now submit a more specific question:


Can is set the API level property 'Send Default Values' dynamically?


What determines if I see a json value in the in my exposed API response?

This is now where I am with this topic:

Is an attribute mandatory or not?
If it is mandatory is it shown in the response

When the attribute in question is not mandatory then the API level  ‘Send Default Values’ property comes into play.
Is the property ‘Send Default Values’ set to ‘Yes’, then I see the value in the response even when it is empty (default value in this case)
When the API level property ‘Send Default Values’ set to ‘No’ then I do not see the empty value (default value) in the response.

What I would like in my scenario is that I can set the ‘Send Default Values’ dynamically.
When our query parameter ‘IncludeTheEmpyResponse’ = true then I want the ‘Send Default Values’ set to ‘Yes’ when the ‘IncludeTheEmpyResponse’ = false.

Is this possible?

Regards, Sven

Hi Sven,

I am glad that was helpful.

Unfortunately the Send Default Values parameter cannot be set dynamically.

There is a solution for attribute that are not lists. However, it looks like you need to return an empty list.

The solution may be then to reconsider the design of the API.  Without understanding your constraints, it may work to have a second API method instead of passing a flag.

To achieve this for a non-list attribute, set Send Default Values back to No for the API, so that the attribute will not be sent when the default is used.

Now navigate to the Data tab, and under structures, locate the attribute in the response structure and set its default value to a value you are confident will never appear in live data.  In other words, set the attribute's default value to a magic number/string. eg -999

In the API method, when the IncludeTheEmptyResponse flag is set to True, set the attribute to a blank value, such as zero, or an empty string.  Because this is not actually the default, it will now appear in the response.

If this helps, feel free to mark it as the solution. Best of luck with your API!

Kind regards,


Hallo Stuart,

Thanks for the answer.

maybe I will use your scenario, but for me this is a possible solution and certainly a basis to proceed!