Variant
Since 6.1.0:
The Variant
class holds typed data. It is used by Ledger. See also VariantArray and VariantMap to hold data that will be converted to JSON.
In Device OS 6.2 and later, a Variant is the best way to send JSON data as it can encode the data more efficiently over the air. See Typed publish for more information.
A Variant can hold arbitary binary data using the Buffer
class in Device OS 6.2 and later. A Variant containing a Buffer
cannot be serialized to JSON or deserialized from JSON as JSON does not support binary values.
If you have a JSON object and want to create code stubs for generating a Variant
with the same
shape, see the JSON tool which has a Variant code generator.