307
Views
2
Comments
REST JSON reponse is only showing boolean values that are false but not true
Question

Personal Edition

11.6.14

I have exposed a GET REST request

Web + Service components

API exposed in the Service module.

This is the data I want to respond back to a REST client.

{
  "sections": {
    "work": true,
    "volunteer": false,
    "education": false,
    "awards": false,
    "publications": false,
    "skills": true,
    "languages": true,
    "interest": false,
    "references": false,
    "projects": true
  }, ........


But in Postman client as well as in the browser I get:

{
    "sections": {
        "education": false,
        "awards": false,
        "publications": false,
        "interest": false,
        "references": false
    },


When I Debug the last part I have the correct above values as a JSON String as a field in an Entity.

I then use JSONDeserialize -> the data looks good as the first one with both true and false values.

Last step is just an assign Out1 to the JSONDeserialize ....

The very last step I can see everything looking good - the Out1 is populated with the structure of the JSON and with the right values.


How can I get all the values passed as showed above in the first sample ?

Ps. I have a Create REST POST which works fine with all field,

Best regards 

Tommy Hägvall




2021-06-09 13-39-18
Agno Silveira
 
MVP

Hello Tommy,

Try set your object/structure to send default value = true, example:

Regards.

UserImage.jpg
Tommy Hägvall

Agno Silveira wrote:

Hello Tommy,

Try set your object/structure to send default value = true, example:

Regards.

Hi, thanx for the advice. I had that enabled Default Value already set.
I tested created a change/update page just altering the JSON data and just changing the text with the boolean and then serialising it back and storing it as text. 


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.