Description
Sets the boolean value for a key. If the key does not exist, then create the key and set its value. If the key already exists, then overwrite the value of this key. If more than one key with the same name already exists, then overwrite the value of the first key. Notice that the IgnoreCase property (true by default) determines whether the key name will be matched in a case-sensitive manner.
Applies to
Syntax
objectname.SetValueBoolean ( Key, Value )
Argument |
Description |
---|---|
objectname |
The name of the JSONPackage object. |
Key |
A string specifying the key name. |
Value |
A boolean specifying the key value. |
Return value
Integer.
Returns 1 if it succeeds and -1 if an error occurs. If any argument's value is null, the method returns null.
Examples
This example modifies the value of the Status key in the JSON string, from TRUE to FALSE.
// Integer SetValueBoolean ( string Key, boolean Value ) Boolean lbl_Status Integer li_Return JsonPackage ljpk_Dept ljpk_Dept = Create JsonPackage // Loads the JSON string to the JSONPackage object ljpk_Dept.loadstring( '{"dept_id":100,"dept_name":"R & D8","Status":true}') // Sets the boolean value of the Status key li_Return = ljpk_Dept.SetValueBoolean("Status", FALSE) If li_Return <> 1 Then // If SetValueBoolean failed // Prints the error message Else lbl_Status = ljpk_Dept.GetValueBoolean("Status") If lbl_Status <> FALSE Then // If the value obtained is different from the value set // Prints the error message End If End If
See also