This pull request adds serde support behind a "serde" feature.
This is allows you to convert the parsed gvas data to and from many common formats such as JSON. This can be useful to process the data in other programming languages or general purpose JSON processing tools (for example generate TypeScript types from JSON to help determine the structure of the data).
For the most part this involves just adding #derive(Serialize, Deserialize) to relevant structs, however, there are some places where custom logic was added:
The Property enum is internally tagged, with the property type contained in the field "type", because this felt like the most compact and natural option.
MapProperty values are serialized as a list of {"key": ..., "value": ...} structs. This was done because JSON only allows string keys in maps.
If a StructProperty contains a GUID it is serialized with an additional field "value" containing the GUID value as a string in the standard format (matching the Debug trait logic). This was done to make working with GUID StructProperties more convenient and more consistent with how GUID-s are shown in other parts of the serialized output. The "properties" field is serialized for all StructProperties to allow for generic processing of all StructProperties regardless of if they contain a GUID or not.
This pull request adds serde support behind a
"serde"
feature.This is allows you to convert the parsed gvas data to and from many common formats such as JSON. This can be useful to process the data in other programming languages or general purpose JSON processing tools (for example generate TypeScript types from JSON to help determine the structure of the data).
For the most part this involves just adding
#derive(Serialize, Deserialize)
to relevant structs, however, there are some places where custom logic was added:{"key": ..., "value": ...}
structs. This was done because JSON only allows string keys in maps.