Date: Thu, 28 Mar 2024 11:39:28 -0700 (PDT) Message-ID: <286410840.287.1711651168747@wiki.srpcs.com> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_286_1429283262.1711651168746" ------=_Part_286_1429283262.1711651168746 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
Adds an array of values to a JSON array. New in 2.1.1
Syntax
Result =3D SRP_Jso= n(Handle, "AddValueArray", Array, Delim)
Returns 1 if successful, 0 if not.
Parameter | Description |
---|---|
Handle | Handle to JSON Entity. Required. |
Array | Array of values to be added to the JSON array.&n= bsp;Required. |
Delim | The array's delimiter. Optional. |
The AddValueArray service adds the given array of values as a single arr= ay node to the end of the array. This only works if Handle is a JSON array.= Normally, to add an array to the end of another array, you'd have to call = AddValue repeatedly= :
ValueArray =3D "1,= 2,3,4" If SRP_Json(SubArrayHandle, "New", "Array") then =09For each Value in ValueArray using "," =09=09SRP_Json(SubArrayHandle, "AddValue", Value) =09Next Value SRP_Json(MainArrayHandle, "Add", SubArrayHandle) SRP_Json(SubArrayHandle, "Release") end
This service does that work for you, simplifying the above code to this:=
SRP_Json(MainArray= Handle, "AddValueArray", "1,2,3,4", ",")
The Delim parameter indicates the delimiter used to separate values in A= rray, which defaults to @FM if omitted.
// Create an array= , add a couple values, then add a sub-array If SRP_Json(ArrayHandle, "New", "Array") then SRP_Json(ArrayHandle, "AddValue", "Hello, World!", "Strin= g") SRP_Json(ArrayHandle, "AddValue", 67890, "Number") SRP_Json(ArrayHandle, "AddValueArray", "1~2~3~4~5", "~") SRP_Json(ArrayHandle, "Release") end