Hiding the object name of a list in mendix JSON strucure

0
Hi,   I want to hide the striked section in the JSON Structure while mapping with a message definition. I know it is possible to map based on JSON Structure then the list object is generated with name JSONObject. I want to know is it possible to do it with the message definition.  "Documents": {     "DocumentData": [       {         "Name": "string",         "Base64": "string"       }     ]   }
asked
3 answers
1

Hi Thomas, 

 

If you just have two entities (one Documents with many DocumentData) you can put that in a message definition, and then a normal export mapping will return something like:

 

{"DocumentData":[{"Name":"A","Base64":"aaaa"},{"Name":"B","Base64":"bbbb"}]}

 

If you then go to your message definition to the `DocumentData_Documents` associations, and change the value in column `External Name` to `Documents` (it's a bit hard to see, but you can) and then rebuild your export mapping, the output is:

 

{"Documents":[{"Name":"A","Base64":"aaaa"},{"Name":"B","Base64":"bbbb"}]}

 

which might be what you want. Let me know if this what you are looking for, it could be that you are really looking for a situation with 3 entities. That is a bit more complicated.

 

Regards, 

 

Paul

 

 

 

answered
0

Hello Thomas,

 

Would you mind sharing what your domain model looks like and what the resulting JSON structure should look like after striking out that section?

 

Thanks

answered
0

Here is an example of my domain model and JSON structure what I want. 

"Documents": [

      {

        "Name": "string",

        "Base64": "string"

      }

    ]

  }

Domain model.png

 

 

answered