Date: Fri, 29 Mar 2024 01:26:55 -0700 (PDT) Message-ID: <1009236561.463.1711700815399@wiki.srpcs.com> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_462_1422890604.1711700815399" ------=_Part_462_1422890604.1711700815399 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
Removes a member from a JSON object or an element from a JSON ar= ray.
Syntax
Result =3D SRP_Jso= n(Handle, "Remove", Identifier)
Returns 1 if successful, 0 if not.
Parameter | Description |
---|---|
Handle | Handle to a JSON Entity. Required.<= /strong> |
Identifier | The object member or array element to find. = ;Required. |
The Remove service removes a child from a JSON entity. This service only= works on JSON objects and JSON arrays and will return 0 for entities of ty= pe String, Number, and Boolean. If the entity is a JSON object, then the id= entifier should be a member name. For example, you would pass "FirstName" t= o remove a member whose name is "FirstName". If the entity is a JSON array,= then identifier should be an element index. For example, you would pass "1= 0" to remove the tenth element. Note that removing an element from an array= doesn't actually change the size of the array. Rather, the element at the = given index is set to null.
// Create a JSON a= rray, add elements to it, then remove one If SRP_Json(ArrayHandle, "New", "Array") then SRP_Json(ArrayHandle, "AddValue", "12345") SRP_Json(ArrayHandle, "AddValue", 67890, "Number") SRP_Json(ArrayHandle, "AddValue", 1, "Boolean") Result =3D SRP_Json(ArrayHandle, "Remove", 2)  = ; ; // Sets element 2 to null SRP_Json(ArrayHandle, "Release") end // Create a JSON object, add members to it, then remove one If SRP_Json(ObjectHandle, "New", "Object") then SRP_Json(ObjectHandle, "SetValue", "name", "John Doe") SRP_Json(ObjectHandle, "SetValue", "city", "Washington D.= C.") Result =3D SRP_Json(ObjectHandle, "Remove", "city") = ; // removes "city" member SRP_Json(ObjectHandle, "Release") end