Http response to Json

0
I have an http response in the format: {     "ErrorCode": "err_0",     "ResponseCode": 200,     "ResponseData": [         {             "attr1": 4,             "attr2": 5,             "attr3": 1,             "attr4": 1,             "attr5": ""         },         {             "Aug": {                 "attrA": 0,                 "attrB": 0,                 "attrC": 0,                 "attrD": 0,                 "attrE": "0"             },             "Sep": {                 "attrA": 0,                 "attrB": 0,                 "attrC": 0,                 "attrD": 0,                 "attrE": "0"             }         }     ],     "body": "Success" } But the problem is when this particular json structure is used to create an import mapping  (to be used in response of the call rest api activity), the non-persistent object created has an entity JsonObject as the ResponseData is a list/array, and the first element of it is not associated with a key like Aug, Sep. But in mendix, an entity has to be named and hence the first element is described in the “JsonObject” entity and associated with ResponseData.    When this import mapping structure is used, it does not capture the ResponseData field as the actual response structure does not match the defined structure in mendix (the first element does not have the key name JsonObject in the actual response). And hence I am not able to access the Data in ResponseData field. I tried using the System.HTTPResponse, but that does not render the ResponseData either.   The latesthttpresponse also returns the above values.   I am able to view all the content in the response body if chose to store it in a string variable but I have not found any built in methods to convert string to json. I am not sure how to map string to json by creating a json object of the non-persistent object.   Any help is appreciated. Kindly suggest methods to solve this. Thank you
asked
1 answers
0

I think you could map the jsonObject with a microflow, but I'm not sure.  Since they are on the same level, you could determine in a microflow what kind of object it is there. Since they are all mapped to the same parent. Then handle the rest in the microflow

 

 

 

 

answered