Hi There,
One of the nice things about assignment is that arrays and objects are automagically created, so if I do the following assignments, everything gets created:
The following happens:
My question is why is the last twelve interpreted as a keyname for an object and not as an array of twelve elements, as the keys before it are?
So key2.5.12
creates a key key2
that becomes an array of 5 with the fifth element being an object with a key '12' with a value of 'dd'. I would have expected key2
to be an array with the five elements with the fifth value being an array of 12 elements with the twelfth element being 'dd'.
From the examples, it seems that the rule is that the last value is always a key-name for an object.
My question is therefore: is this assumption correct and is it a desired feature or a bug?
If it's a bug, it probably won't be fixed because of backward compatibility ...
[{"id":"518f89ca72f43970","type":"inject","z":"0dfc0365d20e2613","name":"","props":[{"p":"key1.123","v":"dd","vt":"str"},{"p":"key2.5.12","v":"dd","vt":"str"},{"p":"key3.5.3.12","v":"dd","vt":"str"},{"p":"key4.5.3.1.12","v":"dd","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":876,"y":1628,"wires":[["7b6f6a4bc9e6e2ac"]]},{"id":"7b6f6a4bc9e6e2ac","type":"debug","z":"0dfc0365d20e2613","name":"debug 445","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1177,"y":1495,"wires":[]}]
Cheers!