Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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 Normally, to set an array at at given location, you have to create the array first and load all its values, like this:

Code Block
ValueArray = "1,2,3,4"
If SRP_Json(ArrayHandle, "New", "Array") then
    For each Value in ValueArray using ","
        SRP_Json(ArrayHandle, "AddValue", Value)
    Next Value
    SRP_Json(ObjectHandle, "Set", "my-array", ArrayHandle)
    SRP_Json(ArrayHandle, "Release")
end

This service does that work for you, simplifying the above code to this:

Code Block
SRP_Json(ObjectHandle, "SetValueArray", "my-array", "1,2,3,4", ",")

Delim indicates the delimiter used to separate values in Array, which defaults to @FM if omitted.The Delim parameter indicates the delimiter used to separate values in Array, which defaults to @FM if omitted.

...