Difference between revisions of "LlList2Json"

From Second Life Wiki
Jump to: navigation, search
m (moving the constants in the "see also constants")
Line 1: Line 1:
 
{{LSL Function
 
{{LSL Function
|func_id=|func_sleep=0.0|func_energy=10.0
+
|func_id=|func_sleep=0.0|func_energy
|func=llList2Json|return_type=string|p1_type=string|p1_name=type|p2_type=list|p2_name=values
+
|func=llList2Json|return_type=string
 +
|p1_type=string|p1_name=type|p1_desc=
 +
|p2_type=list|p2_name=values|p2_desc=
 
|func_footnote=
 
|func_footnote=
 
To convert a json formatted string into a list use [[llJson2List]].
 
To convert a json formatted string into a list use [[llJson2List]].
 
|func_desc=This function takes a list and returns a [http://json.org JSON] string of that list as either a json object or json array.
 
|func_desc=This function takes a list and returns a [http://json.org JSON] string of that list as either a json object or json array.
|return_text=made by parsing '''src''', a string representing json.
+
|return_text=that is either {{LSLPT|values}} serialized as a JSON {{LSLPT|type}}, or if an error was encountered [[JSON_INVALID]].
 
|spec=See [[Json_usage_in_LSL]]
 
|spec=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_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 [[JSON_ARRAY]] then a string representing a json array will be returned.
 
* If type is any other string then [[JSON_INVALID]] will be returned.
 
* If type is any other string then [[JSON_INVALID]] will be returned.
|constants=
+
|constants={{Constants/JSON|subset=*}}
 
|examples
 
|examples
 
|helpers
 
|helpers

Revision as of 12:04, 12 June 2013

Summary

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.

Specification

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.
Template:Constants/JSON

Examples

See Also

Constants

•  JSON_ARRAY
•  JSON_OBJECT
•  JSON_INVALID

Functions

•  llJson2List
•  llJsonGetValue
•  llJsonSetValue
•  llJsonValueType

Articles

•  Typecast

Deep Notes

Search JIRA for related Issues

Signature

function string llList2Json( string type, list values );