LedgerData

operator[name] [LedgerData class]

Get a reference to the entry value with the given name.

The entry is created if it doesn't exist.

The device will panic if it fails to allocate memory for the new entry. Use set() or the methods provided by VariantMap if you need more control over how memory allocation errors are handled.

// PROTOTYPES
Variant& operator[](const char* name);
Variant& operator[](const String& name);

// EXAMPLE - Create an array if necessary and add an element to the array.
data["alarm"].append(reasonCode);

// EXAMPLE - Create an object if necessary and add a key/value pair to it.
data["sensors"].set("temp", tempValue);