AddJSONMember()

语法

Result = AddJSONMember(JSONValue, Key$)
概要
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.

参数

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.

返回值

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

示例

  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

参阅

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

已支持操作系统

所有

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