AddJSONMember()

Syntax

Result = AddJSONMember(JSONValue, Key$)
Description
Add a new member to a JSON value of type #PB_JSON_Object. If a member with the specified key already exists, it will be replaced.

Parameters

JSONValue The JSON value. The value must be of type #PB_JSON_Object.
Key$ The key for the new member. If a member with the same key exists in the object, it will be replaced.

Return value

Returns the address of the added JSON member value. The newly added value initially has type #PB_JSON_Null.

Example

  If CreateJSON(0)
    ObjectValue = SetJSONObject(JSONValue(0))
    
    FirstName = AddJSONMember(ObjectValue, "FirstName")
    SetJSONString(FirstName, "John")
    
    LastName = AddJSONMember(ObjectValue, "LastName")
    SetJSONString(LastName, "Smith")    
    
    Debug ComposeJSON(0)
  EndIf

See Also

SetJSONObject(), RemoveJSONMember(), ClearJSONMembers(), GetJSONMember(), ExamineJSONMembers(), JSONObjectSize(), JSONType()

Supported OS

All

<- AddJSONElement() - Json Index - CatchJSON() ->