116
Views
6
Comments
Solved
Json to Structure
Question

Hi everyone,

I am trying to create a structure from json but getting the below error. The Json I am using is valid. How do I fix this? 

2025-12-15 09-29-24
Thibaut G
Solution

The error message indicates that the issue in your JSON lies with the presence of empty "Metadata" objects. the parameters for this object should be present even if the value is null. 
If you don't need the metadata, you can just remove the metadata object from the json structure and it should work

2025-01-09 14-56-57
IQ78

yes, i was experiencing the same and remove all the metadata.

But i am not sure, if there is a response from rest api with  the metadata then deserialize it into the structure, does it still work? no error?

thanks

2022-07-25 09-47-59
Simran Vaswani

This worked! thanks!


2025-12-15 09-29-24
Thibaut G

I believe that if the "response" structure in OutSystems does not precisely match the structure of the actual API response body, OutSystems will still attempt to map the corresponding objects and parameters present in both structures. It seems that, in such cases, OutSystems may handle the mapping gracefully without triggering errors. However, to confirm this, I would need to conduct thorough testing. As of now, I haven't encountered a scenario where only specific portions of the API response are required.

2025-01-09 14-56-57
IQ78

thanks, 

this is mainly the use case of consuming 3rd party API (say it Stripe for payment gateway), the response object is so excessive and i cannot find the complete one (the response in json format that is has complete value for each field- not null), and the response return also only some of the fields if we test it. So, we only copy part of the response to be structures, and for another scenario may be the stripe will also return another field that is not in the structure created before.

regards

UserImage.jpg
Neha Bhimsaria

Hello Simran, 

As I can see you have to put some values in the structure may be just sample values for the structure to create. 

Thank you 

Neha

2025-12-15 09-29-24
Thibaut G
Solution

The error message indicates that the issue in your JSON lies with the presence of empty "Metadata" objects. the parameters for this object should be present even if the value is null. 
If you don't need the metadata, you can just remove the metadata object from the json structure and it should work

2025-01-09 14-56-57
IQ78

yes, i was experiencing the same and remove all the metadata.

But i am not sure, if there is a response from rest api with  the metadata then deserialize it into the structure, does it still work? no error?

thanks

2022-07-25 09-47-59
Simran Vaswani

This worked! thanks!


2025-12-15 09-29-24
Thibaut G

I believe that if the "response" structure in OutSystems does not precisely match the structure of the actual API response body, OutSystems will still attempt to map the corresponding objects and parameters present in both structures. It seems that, in such cases, OutSystems may handle the mapping gracefully without triggering errors. However, to confirm this, I would need to conduct thorough testing. As of now, I haven't encountered a scenario where only specific portions of the API response are required.

2025-01-09 14-56-57
IQ78

thanks, 

this is mainly the use case of consuming 3rd party API (say it Stripe for payment gateway), the response object is so excessive and i cannot find the complete one (the response in json format that is has complete value for each field- not null), and the response return also only some of the fields if we test it. So, we only copy part of the response to be structures, and for another scenario may be the stripe will also return another field that is not in the structure created before.

regards

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