From Second Life Wiki
Revision as of 12:00, 17 September 2014 by Strife Onizuka (Talk | contribs)

Jump to: navigation, search


Function: string llList2Json( string type, list values );

This function takes a list and returns a JSON string of that list as either a json object or json array.
Returns a string that is either values serialized as a JSON type, or if an error was encountered JSON_INVALID.

• string type
• list values

To convert a json formatted string into a list use llJson2List.


See Json_usage_in_LSL

  • If type is JSON_OBJECT the list must be a strided list of key, value pairs and a string representing a json object will be returned.
  • If type is JSON_ARRAY then a string representing a json array will be returned.
  • If type is any other string then JSON_INVALID will be returned.
  • Json types from the input list are inferred from the LSL data type
Type Flags Value Unicode URL Encoded HTML Encoded Description
JSON_INVALID U+FDDO "%EF%B7%90"  Value returned when inputs are not well formed.


  • Note that string values items are interpreted as JSON, not LSL strings. Quotation marks, if required, must be added explicitly. For example, llJson2List(llList2Json(JSON_ARRAY, ["bacon", "true", "false", "null"])) returns the LSL list ["bacon", JSON_TRUE, JSON_FALSE, JSON_NULL], while llJson2List(llList2Json(JSON_ARRAY, ["\"bacon\"", "\"true\"", "\"false\"", "\"null\""])) returns the LSL list ["bacon", "true", "false", "null"]
All Issues ~ Search JIRA for related Bugs


<lsl> string CSV2Json(string csv) {

   list li = llCSV2List(csv);
   return llList2Json(JSON_ARRAY, li);

} // This function converts a comma separated values string to a Json array string. // CSV strings are often used for link-messages, notecards and they are easier to type as input commands. // A Json-Array can store multiple of those as a nested list within the same Json-string via JSON_APPEND. </lsl>

  • You could store multiple lists that set different particle effects in the same string. Use LlList2Json() to write the string and llJson2List() to read the particle system defining lists from it. The loss in float-accuracy (Json has BAD float-to-string-conversion) does not matter as much for particle effects.
  • You could store multiple lists, that set different llSetPrimitiveparamsFast() values for different situation (like different animation key frames), in the same Json String.

See Also




•  llJson2List
•  llJsonGetValue
•  llJsonSetValue
•  llJsonValueType


•  Typecast

Deep Notes


Date of Release 20/05/2013

Search JIRA for related Issues


function string llList2Json( string type, list values );


Their ships list to port
for what reason I know not
we list to JSON

Listen to Jason
cryptically my sensei said
I must have misheard