CreateJSON()

Syntax

Result = CreateJSON(#JSON [, Flags])
Description
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.

Parameters

#JSON A number to identify the new JSON. #PB_Any can be used to auto-generate this number.
Flags (optional) Not used.

Return value

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.

Example

  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

See Also

LoadJSON(), ParseJSON(), JSONValue(), FreeJSON()

Supported OS

All

<- ComposeJSON() - Json Index - ExamineJSONMembers() ->