JSON Objects to list

0
I am calling the Rest service from to one source and its returning an objects instead of list in Json body. Looks like the Json was implemented wrongly. How can we convert a Json objects to a list in Mendix. Any pointers would be helpful.   Example Object : "3300965": [ { "action": "DT-TDS-04-2020 - RIA Research and Innovation action", "plannedOpeningDate": "19 November 2019", "deadlineModel": "single-stage", "deadlineDates": [ "18 June 2020" ], "budgetYearMap": { "2020": 35000000 }, "budgetTopicActionMap": {} } ],   in below Json.   What are the possible ways to converts this objects to list in Mendix. Exapmple Json:   "budgetTopicActionMap": { "3300965": [ { "action": "DT-TDS-04-2020 - RIA Research and Innovation action", "plannedOpeningDate": "19 November 2019", "deadlineModel": "single-stage", "deadlineDates": [ "18 June 2020" ], "budgetYearMap": { "2020": 35000000 }, "budgetTopicActionMap": {} } ], "3300966": [ { "action": "DT-TDS-01-2019 - IA Innovation action", "plannedOpeningDate": "26 July 2018", "deadlineModel": "single-stage", "deadlineDates": [ "14 November 2018" ], "budgetYearMap": { "2019": 60000000 }, "budgetTopicActionMap": {} } ], "3300967": [ { "action": "SU-TDS-02-2018 - RIA Research and Innovation action", "plannedOpeningDate": "07 November 2017", "deadlineModel": "single-stage", "deadlineDates": [ "25 April 2018" ], "budgetYearMap": { "2018": 35000000 }, "budgetTopicActionMap": {} } ],
asked
3 answers
0

That is not valid JSON, right? If you want to use an import mapping, you need to have valid JSON. Maybe you can use string functions to turn it into valid json?

answered
0

Is this the JSON that is used to build the EU tendering pages? e.g https://ec.europa.eu/info/funding-tenders/opportunities/data/topicDetails/dt-tds-01-2019.json


If so, I think is quite specific to their page needs. You are probably going to have to look at string manipulation to transform it into a format that better suits your requirements.

answered
0

You have the object defined in a domain model? If not, then first do so.

Then create a MessageDefinition by, in your App Explorer, rightclicking on any modulename, then ‘Add other’=>'Message definition’.

Open the messagedefinition and Add the object's entity.

Now click generate mappings.

Create a microflow that creates a list of your objects and calls the generated export-mapping.

Voila: your JSON.

answered