CreateJSON()
语法
Result = CreateJSON(#JSON [, Flags])概要
Create new, empty JSON data. Initially, the data will contain a JSON value of type #PB_JSON_Null. The JSONValue() function can be used to access this value to change it.
参数
#JSON A number to identify the new JSON. #PB_Any can be used to auto-generate this number. Flags (optional) If set to #PB_JSON_NoCase, the JSON data will be treated as case insensitive. The default is to be case sensitive.
返回值
Nonzero if the JSON data was created correctly, zero otherwise. If #PB_Any was used for the #JSON parameter then the generated number is returned on success.
Remarks
JSON is a case sensitive data format. However, in some situations, such as deserializing structures with ExtractJSONStructure() or similar commands it may be useful to treat JSON objects as case insensitive. The #PB_JSON_NoCase flag causes all member related functions to treat keys in this object as case insensitive.
示例
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
参阅
CatchJSON(), LoadJSON(), ParseJSON(), JSONValue(), FreeJSON()
已支持操作系统
所有