Set( ) method (JsonObject)
- Last Updated: January 18, 2024
- 1 minute read
- OpenEdge
- Version 12.8
- Documentation
Sets the named property of JsonObject to the given value. On successful execution, the method returns TRUE.
Return type: LOGICAL
Access: PUBLIC
Applies to: Progress.Json.ObjectModel.JsonObject class
Syntax
|
- property-name
- A CHARACTER expression that indicates the name of the existing
property whose value is to be changed.
property-name is case-sensitive.
A JsonError is raised if:
- property-name is the empty
string (""), or is the Unknown value (
?) - The property does not exist
- property-name is the empty
string (""), or is the Unknown value (
- value
- Indicates the new value to which the property is to be set.
The data type of the property is defined by the data type mapping
described below. If value is the Unknown value (
?) the property is set to a JSON null value.The data type of the JSON value set by this method call depends upon the ABL data type of the value parameter.
Table 1. Value parameter A value parameter of data type Data type of JSON value CHARACTER, LONGCHAR
string INTEGER, INT64, DECIMAL number LOGICAL boolean MEMPTR, RAW, ROWID string with a value as if you had called BASE64-ENCODE( )on valueDATE, DATETIME, DATETIME-TZ string with a value as if you had called ISO-DATE( )on valueCOM-HANDLE, HANDLE, RECID number with a value as if you had called INTEGER( )on value
Setting a property to an ABL value that maps to a different JSON data type than the current data type changes the elements's data type. For example:
|
In the above example, iType is
set to Progress.Json.ObjectModel.JsonDataType:BOOLEAN. (See Progress.Json.ObjectModel.JsonDataType class.)
If you set the property to a JsonObject or JsonArray that references this JsonObject or a JSON construct further up the JSON construct tree, a JsonError is raised.