pbUseVariantMetaData - cJsonObject
Determines how variants are serialized
Type: Property
Access: Read/Write
Data Type: Boolean
Parameters: None
Syntax
Property Boolean pbUseVariantMetaData
| Access Type | Syntax |
|---|---|
| Read Access: | Get pbUseVariantMetaData to BooleanVariable |
| Write Access: | Set pbUseVariantMetaData to BooleanVariable/Value |
Description
This property determines how variants are serialized. Variants can contain several types of values and when serialized to JSON without adding meta data, they can't always be properly de-serialized with the properly typed value. For example, when a variant containing a struct value is serialized with pbUseVariantMetaData set to False, it serializes the struct properly, but when deserializing, it doesn't know what struct type was used, so it can't reinitialize the proper struct.
Setting this property to Ttrue will serialize variants into JSON objects with a property 'vt', inidicating the variant type and, in case of a struct, a property 'st' will be added with the name of the struct that was used. In case of an array, a property 'at' will be added, indicating the array type.
When the JSON is purely used to serialize data from memory for storage, this property can be used to enable proper support for variants. It needs to be set on the object on which DataTypeToJson and JsonToDataType is being called.