ComposeJSON()
语法
Result$ = ComposeJSON(#JSON [, Flags])概要
Compose the given JSON data into a string. A string can be parsed back into JSON data using the ParseJSON() function.
参数
#JSON The JSON to compose. Flags (optional) If set to #PB_JSON_PrettyPrint, the composed string will contain additional newline and whitespace for better readability. The extra whitespace is not significant to the JSON format. The output will have the same meaning to a JSON reader with or without this flag.
返回值
The JSON data as a string.
Remarks
The output string has the string format of the executable (Ascii or Unicode). JSON is generally encoded in UTF-8, so when writing the result string to a file or sending it to another application, it is advised to convert the string to UTF-8 before doing so.
示例
If CreateJSON(0) Person = SetJSONObject(JSONValue(0)) SetJSONString(AddJSONMember(Person, "FirstName"), "John") SetJSONString(AddJSONMember(Person, "LastName"), "Smith") SetJSONInteger(AddJSONMember(Person, "Age"), 42) Debug ComposeJSON(0, #PB_JSON_PrettyPrint) EndIf
参阅
SaveJSON(), ExportJSON(), ExportJSONSize(), ParseJSON()
已支持操作系统
所有