Table of Contents

Codeunit Json

ID 5460
Namespace: System.Text.Json

Properties

Name Value
Access Public
InherentEntitlements X
InherentPermissions X

Methods

InitializeCollection

Initializes the JSON array with the specified JSON string.

procedure InitializeCollection(JSONString: Text)

Parameters

Name Type Description
JSONString Text

The Json string

InitializeObject

Initializes the JSON object with the specified JSON string.

procedure InitializeObject(JSONString: Text)

Parameters

Name Type Description
JSONString Text

The Json string

GetCollectionCount

Returns the number of elements in the JSON array.

procedure GetCollectionCount(): Integer

Returns

Type Description
Integer

The number of elements in the JSON array

GetCollectionAsText

Returns the JSON array in text format.

procedure GetCollectionAsText(): Text

Returns

Type Description
Text

The JSON array in text format

GetCollectionAsText

Returns the JSON array in text format.

procedure GetCollectionAsText(Indentation: Boolean): Text

Parameters

Name Type Description
Indentation Boolean

Specified whether the text should be indented.

Returns

Type Description
Text

The JSON array in text format

GetCollection

Returns the JSON array.

procedure GetCollection(): JsonArray

Returns

Type Description
JsonArray

The JSON array

GetObjectAsText

Returns the JSON object in text format.

procedure GetObjectAsText(): Text

Returns

Type Description
Text

The JSON object in text format

GetObject

Returns the JSON object.

procedure GetObject(): JsonObject

Returns

Type Description
JsonObject

The JSON object

GetObjectFromCollectionByIndex

Returns the JSON object at the specified index in the JSON array.

procedure GetObjectFromCollectionByIndex(Index: Integer, var JsonObjectTxt: Text): Boolean

Parameters

Name Type Description
Index Integer

The index of the JSON object

JsonObjectTxt Text

The JSON object in text format

Returns

Type Description
Boolean

True if the JSON object is returned; otherwise, false

GetValueAndSetToRecFieldNo

Gets the value at the specified property path in the JSON object and sets it to the specified record field.

procedure GetValueAndSetToRecFieldNo(RecordRef: RecordRef, PropertyPath: Text, FieldNo: Integer): Boolean

Parameters

Name Type Description
RecordRef RecordRef

The record reference

PropertyPath Text

The property path

FieldNo Integer

The field number

Returns

Type Description
Boolean

True if the value is set to the record field; otherwise, false

Remarks

Next type of fields are supported: Integer, Decimal, Date, Boolean, GUID, Text, Code, Option, BLOB, RecordID Text values are trimmed to the Max Length of the field.

GetPropertyValueByName

Gets the value at the specified property name in the JSON object.

procedure GetPropertyValueByName(PropertyName: Text, var Value: Variant): Boolean

Parameters

Name Type Description
PropertyName Text

The property name

Value Variant

The value

Returns

Type Description
Boolean

True if the value is returned; otherwise, false

GetStringPropertyValueByName

Gets the text value at the specified property name in the JSON object.

procedure GetStringPropertyValueByName(PropertyName: Text, var Value: Text): Boolean

Parameters

Name Type Description
PropertyName Text

The property name

Value Text

The value

Returns

Type Description
Boolean

True if the value is returned; otherwise, false

GetEnumPropertyValueFromJObjectByName

Gets the option value at the specified property name in the JSON object.

procedure GetEnumPropertyValueFromJObjectByName(PropertyName: Text, var Value: Option): Boolean

Parameters

Name Type Description
PropertyName Text

The property name

Value Option

The value

Returns

Type Description
Boolean

True if the value is returned; otherwise, false

GetBoolPropertyValueFromJObjectByName

Gets the boolean value at the specified property name in the JSON object.

procedure GetBoolPropertyValueFromJObjectByName(PropertyName: Text, var Value: Boolean): Boolean

Parameters

Name Type Description
PropertyName Text

The property name

Value Boolean

The value

Returns

Type Description
Boolean

True if the value is returned; otherwise, false

GetDecimalPropertyValueFromJObjectByName

Gets the decimal value at the specified property name in the JSON object.

procedure GetDecimalPropertyValueFromJObjectByName(PropertyName: Text, var Value: Decimal): Boolean

Parameters

Name Type Description
PropertyName Text

The property name

Value Decimal

The value

Returns

Type Description
Boolean

True if the value is returned; otherwise, false

GetIntegerPropertyValueFromJObjectByName

Gets the integer value at the specified property name in the JSON object.

procedure GetIntegerPropertyValueFromJObjectByName(PropertyName: Text, var Value: Integer): Boolean

Parameters

Name Type Description
PropertyName Text

The property name

Value Integer

The value

Returns

Type Description
Boolean

True if the value is returned; otherwise, false

GetGuidPropertyValueFromJObjectByName

Gets the Guid value at the specified property name in the JSON object.

procedure GetGuidPropertyValueFromJObjectByName(PropertyName: Text, var Value: Guid): Boolean

Parameters

Name Type Description
PropertyName Text

The property name

Value Guid

The value

Returns

Type Description
Boolean

True if the value is returned; otherwise, false

ReplaceOrAddJPropertyInJObject

Replace or add the specified property in the JSON object.

procedure ReplaceOrAddJPropertyInJObject(PropertyName: Text, Value: Variant): Boolean

Parameters

Name Type Description
PropertyName Text

The property name

Value Variant

The value

Returns

Type Description
Boolean

True if the property is replaced or added; otherwise, false

AddJObjectToCollection

Add the the JSON object to the JSON array.

procedure AddJObjectToCollection(Value: Text): Boolean

Parameters

Name Type Description
Value Text

The JSON object in text format

Returns

Type Description
Boolean

True if the JSON object is added; otherwise, false

RemoveJObjectFromCollection

Remove the JSON object at the specified index in the JSON array.

procedure RemoveJObjectFromCollection(Index: Integer): Boolean

Parameters

Name Type Description
Index Integer

The index of the JSON object

Returns

Type Description
Boolean

True if the JSON object is removed; otherwise, false

ReplaceJObjectInCollection

Replace the specified JSON object in the JSON array.

procedure ReplaceJObjectInCollection(Index: Integer, Value: Text): Boolean

Parameters

Name Type Description
Index Integer

The index of the JSON object

Value Text

The JSON object in text format

Returns

Type Description
Boolean

True if the JSON object is replaced; otherwise, false

See also