Remove$

Remove$ removes data from a JSON document using a JSON pointer.

Syntax

 RETURN_VALUE = JSON_OBJECT.Remove$(EXPRESSION)
  • RETURN_VALUE is a boolean that indicates whether the operation was successful or not.
  • JSON_OBJECT is an instance constructed using the ParseInstance instruction applied to a JSON document. This corresponds to the JSON parser used to access and modify the JSON document.
  • EXPRESSION is an expression that corresponds to the key being searched in the JSON document. EXPRESSION uses JSON pointer syntax. You can find more information regarding the syntax of JSON pointers by reading the standard documentation here.

Examples

# Let's remove a member from a JSON document:
Funprog Remove_Member()
	 Local Clbfile SRCJSON
	 SRCJSON = '{"foo": "bar", "bar": "abc"}'
        Local Instance Obj using Object
        ParseInstance Obj with SRCJSON
        Local Boolean R1, R2
        R1 = OBJ.Remove$("/foo")
	 Local Clbfile MYCLB
        R2 = OBJ.Get$("", MYCLB)
        FreeGroup OBJ
End MYCLB -> Returns {"baz": "abc"}

Description

Remove$ removes the key and its value from a JSON document using the JSON pointer syntax.

The result of this function has the boolean type.

Return values

Value Explanation
0 Operation succeeded.
-6 The name of the variable does not exist in the JSON document.
-26 Invalid JSON document or unable to remove.
-70 Invalid argument type.

See also

Add$
Contains$
Get$
Parse Instance
Replace$
Select$