Add( ) method (JsonObject)

Creates a property with a given name and value. On successful execution, this method returns TRUE.

Return type: LOGICAL

Access: PUBLIC

Applies to: Progress.Json.ObjectModel.JsonObject class

Syntax

Add( INPUT property-name AS CHARACTER,
     INPUT value AS CHARACTER )

Add( INPUT property-name AS CHARACTER,
     INPUT value AS COM-HANDLE )

Add( INPUT property-name AS CHARACTER,
     INPUT value AS DATE )

Add( INPUT property-name AS CHARACTER,
     INPUT value AS DATETIME )

Add( INPUT property-name AS CHARACTER,
     INPUT value AS DATETIME-TZ )

Add( INPUT property-name AS CHARACTER,
     INPUT value AS DECIMAL )

Add( INPUT property-name AS CHARACTER,
     INPUT value AS HANDLE )

Add( INPUT property-name AS CHARACTER,
     INPUT value AS INT64 )

Add( INPUT property-name AS CHARACTER,
     INPUT value AS INTEGER )

Add( INPUT property-name AS CHARACTER,
     INPUT value AS LOGICAL )

Add( INPUT property-name AS CHARACTER,
     INPUT value AS LONGCHAR )

Add( INPUT property-name AS CHARACTER,
     INPUT value AS MEMPTR )

Add( INPUT property-name AS CHARACTER,
     INPUT value AS RAW )

Add( INPUT property-name AS CHARACTER,
     INPUT value AS RECID )

Add( INPUT property-name AS CHARACTER,
     INPUT value AS ROWID )

Add( INPUT property-name AS CHARACTER,
     INPUT value AS CLASS JsonObject )

Add( INPUT property-name AS CHARACTER,
     INPUT value AS CLASS JsonArray )
property-name
A CHARACTER expression naming the new property to be created. This name can be any string that can be represented as a valid Unicode string.

If a property by this name already exists in this JsonObject or if this parameter is an empty string ("") or is the Unknown value (?), a JsonError is raised.

value
The value to which the new 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 the a JSON null value.

If you add a JsonObject or JsonArray that references this JsonObject or a construct further up the JSON construct tree, a JsonError is raised.

The data type of the added JSON value set by this method call depends upon the ABL data type of the value parameter.

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 value
DATE, DATETIME, DATETIME-TZ string with a value as if you had called ISO-DATE( ) on value
COM-HANDLE, HANDLE, RECID number with a value as if you had called INTEGER( ) on value