You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Sets a member within a JSON object or element within a JSON array to the given array of values.

Syntax

Result = SRP_Json(Handle, "SetValueArray", Identifier, Array, Delim)

Returns

Returns 1 if successful, 0 if not.

Parameters

ParameterDescription
HandleHandle to a JSON Entity. Required.
ArrayArray of values to be put into the JSON entity. Required.
DelimThe array's delimiter. Optional.

Remarks

The SetValueArray service sets a child within a given JSON Entity. This service only works on JSON objects and JSON arrays. If it is a JSON object, then Identifier needs to be a member name, such as "id" or "first-name". If it is a JSON array, then identifier needs to be an index, such as 1 or 10. This is like calling SetValue for each item in Array. Delim indicates the delimiter used to separate values in Array, which defaults to @FM if omitted.

Example

// Create a JSON object and add an array as one of the members
If SRP_Json(ObjectHandle, "New", "Object") then
   SRP_Json(ObjectHandle, "SetValueArray", "phone", "(555) 555-1234":@FM:"(555) 555-9876")
   SRP_Json(ObjectHandle, "SetValueArray", "contacts", "Joe,Bob,Kevin", ",")
   SRP_Json(ObjectHandle, "Release")
end

See Also

SetValue

  • No labels