Facing issues when consuming response in outsystems (JSON substructure is inconsist)

We are trying to integrate commecetool with Outsystems using there API. Attaching the json sample response file with this email.

We are facing issue while consuming this response in Outsystems, as one of its substructure is inconsistent with its attributes. Hence Outsystems is not able to generate a correct structure for the same and map its response.
Please see the below screenshot for instance. Also attaching the error that we get on the screen when consumed the response as is.

We are running out of options to resolve this.

please suggest some options. Thanks in advance.

Hi Shraddha,

the response is very strange, since in attributes[3] the value holds an integer, and in attributes[4] it holds a Json structure. So the model that you are consuming is incorrect. If you really need to consume this, you might try to change something in the onbeforerequest, to e.g. change "value" that only holds a value to another attribute 'integervalue'. but the prefered way is to contact the producer of this api. 

regards Hans

Thanks for replying.

Hi Shraddha,

Thie sample json is so strange, i tried to restore the sample JSON you provided, and it seems like this:

First of all, we cant have a record without a name in JSON except a record list. Second, list should be wrapper by brackets, not only braces. Last one, the data type of elements in list shoud be same. The value in the sample JSON can be integer, also can be a record. You can refer to Wiki JSON and format and validate your JSON in JSON Formatter

thank you


 If you've proper/structured JSON in your hand you can directly create structure in Data > Structure > Add Structure from json. It'll create structure based on your modeled data, you need not to create it manually.



thank you

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.