I am working on a http server which is receiving JSON data, but this data must be deserialized into a struct, if I am sending the JSON object in the same order as the struct it will be deseriealized, however if I send the data in a different order which is a common JSON behavior through different frameworks and clients it will throw a pods error.
To Reproduce
This is a quick implementation of the server using pods to handle the JSON Request
It is also have some problems with JSON such the following one:
{
"Data": {
"url": "localhost:3000/endpoint",
"image": "base64image",
"options": null //The issue comes here or in any null value in optional fields
}
}
Hi Santiago,
The fact that the order of fields in the JSON has matters is a limitation of JSON SAX parser. This limitation is made to improve performance.
Description
I am working on a http server which is receiving JSON data, but this data must be deserialized into a struct, if I am sending the JSON object in the same order as the struct it will be deseriealized, however if I send the data in a different order which is a common JSON behavior through different frameworks and clients it will throw a pods error.
To Reproduce
This is a quick implementation of the server using pods to handle the JSON Request
This is how the JSON must be to work
but is the order change it doesn`t work, for example like this JSON:
It is also have some problems with JSON such the following one: