JSON_MERGE
tracked
Nexii Malthus
Like JSON_APPEND but allows merging of json objects and arrays.
JSON_MERGE
A special specifier for llJsonSetValue which indicates the given value should be merged to the array/object at the specified level.
When two objects are merged it will overwrite existing values and add new ones, by looping over the keys of the new object and writing it into the current json. Kinda like Object.assign (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign)
When two arrays are merged it will concat the two arrays together. Kinda like Array.concat (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/concat)
And might as well just spec out the other type behaviours:
When two strings are merged it will concat the two strings together Kinda like String.concat (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/concat)
When two numbers are merged it will add them together. (Allowing you to do stuff like incrementing/decrementing)
If the two types being merged are different, then behaviour is undefined and outside this proposal. Perhaps same as JSON_APPEND: if that level is not of the same type, the existing value there will be overwritten and replaced with the new value.
Log In
Spidey Linden
marked this post as
tracked
Issue tracked. We have no estimate when it may be implemented. Please see future updates here.