LlJson2List/ja

From Second Life Wiki
Jump to navigation Jump to search

要約

関数: list llJson2List( string src );

This function takes a string representing JSON, and returns a list of the top level.
made by parsing src, a string representing json.を list で返します。

• string src

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

仕様

See Json_usage_in_LSL

  • If the json represents a single item (number, string, true, false or null) then a list with 1 item will be returned.
  • If the json represents an object then a strided list of key, value pairs is returned. All values that are objects or arrays are returned as json strings.
  • If the json represents an array then a list of all items is returned. All values that are objects or arrays are returned as json strings.

サンプル

string Json2CSV(string jcsv){//Converts a Json into a string of comma separated values. == Removes the top level [ and ] and all " from top level JSON_STRING values.
    list li = llJson2List(jcsv);
    return llList2CSV(li);
}
//If the Json is a 1-dimensional array of strings like "[\"a\",\"b\",\"c\"]", the returned CSV-string will be: "a,b,c" //This is a much shorter CSV that will save some memory.
//If the Json contains a nested arrays like "[[1,2],[\"PI\",4]]", the returned csv string will be : "[1,2],[\"Pi\",4]" 
//"[1,2],[\"Pi\",4]" is not a very readable CSV-string and not shortened by much. "PI" is not a top level string value because it is nested 1 level deeper. llJson2List unescapes those.

関連項目

関数

•  llList2Json
•  llJsonGetValue
•  llJsonSetValue
•  llJsonValueType

記事

•  Typecast

特記事項

経緯

Date of Release 20/05/2013

Search JIRA for related Issues

Signature

function list llJson2List( string src );
この翻訳は 原文 と比べて古いですか?間違いがありますか?読みにくいですか?みんなで 修正 していきましょう! (手順はこちら)
この項目はあなたにとって参考にならない項目ですか?もしかしたらLSL Wikiの関連した項目が参考になるかもしれません。