68
Views
3
Comments
Solved
Json Serialization or De-Serialization error
Question
Application Type
Reactive

Hi OutSystems Community,

I'm facing an error which is REST API: Parsing 'Id': Cannot deserialize the current JSON object (e.g. {"name": "value"}) into type 'Response[]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly.

Does anyone help me with this error?  Please find the image in which I got an error alert 

Also, we're using structure to store those data and I need to show those data as an Expression in the Accordion widget & please share if anyone has an OML regarding this error, which is always welcome and even helpful to understand.


2020-09-15 13-07-23
Kilian Hekhuis
 
MVP
Solution

 Chiranjeevi,

The error means that the structure you use for the Deserialize doesn't have the same lay-out as the JSON. In particular, you have a List where the JSON only has a single object.

UserImage.jpg
Chiranjeevi Balaji

Hi Kilian,

Thanks & Sorry for the late reply. It's really helpful

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Np. Not that there are REST services that have polymorphic output, and return an object when it's a single object and a list when it's multiple objects. In that case you need to do some additional work to make it work. 

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