Import & Export dynamic JSON

0
Hello Mx Community!   I am consuming a REST API and more specifically I call a GET request to fetch some data. The JSON returned follows the below structure:   {     "id": "string",     "name": "string",     "data": {         "additionalProp1": {},         "additionalProp2": {},         ...         "additionalPropN": {}     } }   The attribute "addtionalProp*" is not a fixed number and its properties are not know beforehand. As an example would be the following:   "data": {     "field1Name": "string"     "field2Name": integer,     "field3Name": decimal,     "field4Name": boolean,     ... }   Also, I would like to mention that I use the same JSON body to make a POST/PUT request.   Is there any way to configure import and export mappings for managing Mx Entities?   Thank you in advance!   KR, George
asked
2 answers
2

As far as i know, There is a no way to configure Import/Export json mapper dynamically in mendix.

How about use javascript action? 

For example, make a entity whose attributes are {id: String, name: String, data: String}. 

After that you can easily add, remove and change the value of data attribute by using JSON.parse int the javascript action.

 

I hope my opinion helps you.

answered
1

I have encountered a similar problem and wrote a little blog about it detailing some ways to approach this.

 

 

answered