I am new at OutSystems and I'm trying to deserialize the content which is an attribute from an entity.
However it ends in error:
Failed to deserialize JSON to Contract: Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'ssMyApp.RestRecords.JSONSTContractStructure' because the type requires a JSON object (e.g. {"name":"value"}) to deserialize correctly.
How can I prevent this from happening?
Hi Marco Silva,
Based on the shared use case, I guess you are trying to deserialize JSON string, an array of contracts.
Refer to this related post: Forum Post
I made some code changes in the shared .oml file. Please find the attachment (comments are also included for the code changes)
Code Changes:
I hope this helps you!
Kind regards,
Benjith Sam
Hello Marco,
The error is correct, the built-in JSON deserializer does not allow you to turn an array of simple types into an Object.
You have a couple of options:
@Craig St.Jean I'm not sure if I can do these options:
I am trying to export the desiarelized content.
On the OML I have the structure it was created by using the Add structure from JSON.
The option for the ardoJson I also don't understand.