Date: Fri, 29 Mar 2024 04:35:51 -0700 (PDT) Message-ID: <423757138.515.1711712151661@wiki.srpcs.com> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_514_772979382.1711712151661" ------=_Part_514_772979382.1711712151661 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
Adds a value to a JSON array.
Syntax
Result =3D SRP_Jso= n(Handle, "AddValue", NewValue, Type)
Returns 1 if successful, 0 if not.
Parameter | Description |
---|---|
Handle | Handle to JSON Entity. Required. |
NewValue | New value to be added to the JSON array. |
Type | The value's type: String, Number, or Boolean.&nb= sp;Optional. |
The AddValue service adds the given value (String, Number, Boolean, or N= ull) to the end of the array. This only works if Handle is a JSON array. Un= like the Add s= ervice, you do not pass a handle to another JSON entity. This method is als= o more convenient and a little faster than Add. When you pass the value without = specifying its type, then its type is automatically determined from th= e value itself. Empty values become Null types and values detected to be a = number become the Number type. Everything else becomes a string. You can al= ways force the type you want by setting the Type parameter explicitly.
// Create a = JSON array (which initializes ArrayHandle) If SRP_Json(ArrayHandle, "New", "Array") then // This will be added as a String (even though the value = contains only numbers) SRP_Json(ArrayHandle, "AddValue", "12345") // Now add an actual number value to the array SRP_Json(ArrayHandle, "AddValue", 67890, "Number") // Add a boolean SRP_Json(ArrayHandle, "AddValue", 1, "Boolean") // Remember to release entities you've created SRP_Json(ArrayHandle, "Release") end