...
Code Block | ||||
---|---|---|---|---|
| ||||
a = { "colors" : "many", "pi" : [3,1,4,1,5,6,9] }; b = {"flop" : 12}; c = a.put(["foo"], b); // c = { "colors" : "many", // "pi" : [3,1,4,1,5,6,9], // "foo" : {"flop" : 12} // }; d = a.put(["foo", "bar"], b); // d = { "colors" : "many", // "pi" : [3,1,4,1,5,6,9], // "foo" : {"bar" : {"flop" : 12}} // }; |
If the first argument is missing (i.e. there is only one argument) then the path is take to be the root and the item is put at the root level of the map:
Code Block | ||||
---|---|---|---|---|
| ||||
e = a.put(b);
// a = {"colors" : "many",
// "pi" : [3,1,4,1,5,6,9]
// "flop" : 12
// }; |