You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What is your use-case and why do you need this feature?
We need a simple and concise way to no lose unknown properties when deserializing JSON. The use case is a process reading a JSON file, with some extra attributes it doesn't know about, makes some changes to the document (leaving alone the attributes it doesn't know about), and re-serialize the JSON file with the modifications.
If unknown properties are just ignored and discarded during deserialization, any extra fields that are not known by the program during deserialization will be silently lost when re-serializing.
Describe the solution you'd like
We need the ability to collect unknown properties into a Map while deserialising, and write them back when serialising. Lots of JSON libraries support this (e.g. in .NET).
The text was updated successfully, but these errors were encountered:
I assume you mean here that you wish to do this in a way that you add a val otherProperties: Map<String,JsonObject> property with a marker annotation to a Serializable class, and then this property is automatically populated by all "extra" properties.
I also assume that you don't wish to write a custom serializer for this behaviour.
I would say that such a feature is worthwhile (in Json) and I've had it in the XML format for a long time (where namespaces make this much more robust). It is not particularly hard to implement.
What is your use-case and why do you need this feature?
We need a simple and concise way to no lose unknown properties when deserializing JSON. The use case is a process reading a JSON file, with some extra attributes it doesn't know about, makes some changes to the document (leaving alone the attributes it doesn't know about), and re-serialize the JSON file with the modifications.
If unknown properties are just ignored and discarded during deserialization, any extra fields that are not known by the program during deserialization will be silently lost when re-serializing.
Describe the solution you'd like
We need the ability to collect unknown properties into a
Map
while deserialising, and write them back when serialising. Lots of JSON libraries support this (e.g. in .NET).The text was updated successfully, but these errors were encountered: