I'm saving a JSON object to file context similar to;
{
"192-168-1-10": [
{
"last_on": 1622751269764
},
{
"last_off": 1622751272068
}
],
"192-16-1-13": [
{
"last_on": 1622751772269
},
{
"last_off": 1622751774284
}
]
}
The data is constructed as; "192-168-1-10
which represents the IP address of a connected device, and last_on
& last_off
are self explanatory timestamps.
Presently, when any of the status's change within each of the array's, I need to reconstruct the whole array, and then write it to context.
global.set(mystore.192-16-1-13, newarray);
The size of the arrays are likely to increase as new features are added, and ideally I would like to just update one value directly, leaving the other values in the respective array unchanged.
Is there a way to write a revised timestamp directly to one of the values, without writing the whole array?