Include Wrapper data in JSON Rest Call

0
Dear experts, I have a hard time trying to find a way to include a list of “additional drivers” into a REST call. Any ideas on how to solve that? Thanks Jonas   The respective JSON looks like the following: {     "gid": "USER_GID",     "tripId": "TRIP_ID",     "carId": "CAR_ID",     "pickupActual": "UNIX_TIMESTAMP",     "addDrivers": [         "GID1",         "GID2"     ] }    The export mapping:
asked
3 answers
1

Hi Jonas,

Your mapping looks good, and I was able to create the correct JSON export using Mendix 8.2.2 with a similar structure. Are you sure you have everything correctly associated when you build your entities?

My test looked like this.


Which gave me

{"gid":"123","tripId":"456","carId":"789","pickupActual":"12345","addDrivers":["Test1","Test2"]}

Hope this helps

answered
1

I don’t understand the question. This mapping should include the List of additional drivers. Is the created json not what you expected?

answered
1

In your export mapping, click button "Select elements”. Do not include the entity AddDrivers to the selected items of your Exportmapping

And for a better understanding of which entity does what, rename “AddDrivers” to “DriverWrapper” and “AdditionalDriversWrapper” to “Driver”. That gives you:

Btw, more people are having trouble with arrays of strings: 96287 and 95172

 

answered