Difference between revisions of "JSON ARRAY/de"

From Second Life Wiki
Jump to navigation Jump to search
(Updated links using {{#var:lang}} to link to German pages.)
(Removed Multi-Lang tag.)
 
Line 1: Line 1:
{{Multi-lang||/de}}
{{LSL Constant/de
{{LSL Constant{{#var:lang}}
|name=JSON_ARRAY
|name=JSON_ARRAY
|type=string
|type=string

Latest revision as of 23:23, 22 October 2013

Beschreibung

Konstante: string JSON_ARRAY = "﷒";

Die string Konstante JSON_ARRAY hat den Wert "﷒"

Wird mit der llList2Json - Funktion verwendet, und beschreibt dass die gegebene Liste (die auch leer sein kann) dazu verwendet werden soll, ein als String serialisiertes Json-Array zu codieren und zurückzugeben.

JSON_ARRAY ist ebenfalls ein möglicher Rückgabewert für die Funktion llJsonValueType, und beschreibt in diesem Fall dass der Json Datentyp an der durch 'Spezifizierer' definierten Stelle ein Json-Array darstellt.

Ähnliche Artikel

Konstanten

Typ-Bezeichner Wert Unicode URL-Code HTML Beschreibung
JSON_INVALID U+FDDO "%EF%B7%90"  Rückgabewert wenn die Daten nicht wohlgeformt sind.
JSON_OBJECT U+FDD1 "%EF%B7%91" 
JSON_ARRAY U+FDD2 "%EF%B7%92" 
JSON_NUMBER U+FDD3 "%EF%B7%93" 
JSON_STRING U+FDD4 "%EF%B7%94" 
JSON_NULL U+FDD5 "%EF%B7%95" 
JSON_TRUE U+FDD6 "%EF%B7%96" 
JSON_FALSE U+FDD7 "%EF%B7%97" 
JSON_DELETE U+FDD8 "%EF%B7%98"  Wird zusammen mit llJsonSetValue benutzt, um ein Schlüssel-Wert-Paar zu löschen.

Funktionen

•  llList2Json
•  llJsonValueType

Beispiele

Erzeugen eines Json-Arrays: <lsl>string jsonText;

default { state_entry() { jsonText = llList2Json(JSON_ARRAY, ["A", 3, "B", <1.0,1.0,1.0>, "C", "A phrase", "D", PI]); } touch_start(integer total_number) { // In the resulting Json array, all Values are separated by a comma (,). llOwnerSay(jsonText); // ["A",3,"B","<1.000000, 1.000000, 1.000000>","C","A phrase","D",3.141593] } }</lsl>

Festellen ob ein Wert in einem Json Text ein Array darstellt: <lsl>string jsonText;

default { state_entry() { // Set jsonText to [3,{"A":77,"B":66},"A phrase"] // A Json array whose second element is a Json object jsonText = "[3,{\"A\":77,\"B\":66},\"A phrase\"]"; llOwnerSay(jsonText); } touch_start(integer total_number) { // Test the entirety of the Json text to see if it's an array // Note use of the empty list for this if (llJsonValueType(jsonText, []) == JSON_ARRAY) { llOwnerSay("The supplied string is a Json array."); // TRUE } else { llOwnerSay("The supplied string is not a Json array."); }

// Test second element of the array if (llJsonValueType(jsonText, [1]) == JSON_ARRAY) { llOwnerSay("The second element of the array is a Json array."); } else { llOwnerSay("The second element of the array is not a Json array."); // TRUE } } }</lsl>

Deep Notes

Nach JIRA-Issues suchen, die sich hierauf beziehen

Signature

string JSON_ARRAY = "﷒";