llJsonSetValue

From Second Life Wiki
Revision as of 15:41, 30 August 2013 by LepreKhaun Resident (talk | contribs) (Added caveat.)
Jump to navigation Jump to search

Summary

Function: string llJsonSetValue( string json, list specifiers, string value );
0.0 Forced Delay
10.0 Energy

Returns, if successful, a new JSON text string which is json with the value indicated by the specifiers list set to value.

If unsuccessful (usually because of specifying an out of range array index) it should, and usually will, return JSON_INVALID. However this is currently, 8/20/2013, broken at depths lower than the topmost level, where it will silently invalidate the return string, so be careful! The return string should always be checked for JSON_INVALID before overwriting the original Json text.

An "out of range array index" is defined to be any Integer specifier greater than the length of an existing array at that level within the Json text or greater than 0 (zero) at a level an array doesn't exist.

A special specifier, JSON_APPEND, is accepted which appends the value to the end of the array at the specified level. Care should be taken- if that level is not an array, the existing Value there will be overwritten and replaced with an array containing value at it's first (0) index.

Contrary to LSL_List, negative indexing of Json arrays is not supported.

If an existing "Key" is specified at that level, its Value will be overwritten by value, otherwise a new "Key":Value pair will be formed within the Json object.

If value is JSON_TRUE, JSON_FALSE or JSON_NULL, the Value set will be the bare words 'true', 'false' or 'null', respectively, at the specified location within json.
Returns a string

• string json
• list specifiers
• string value

Specification

Caveats

Examples

See Also

Functions

•  llList2Json
•  llJson2List
•  llJsonGetValue
•  llJsonValueType

Articles

•  Typecast

Deep Notes

History

Date of Release 20/05/2013

Signature

function string llJsonSetValue( string json, list specifiers, string value );