Modifier

Partager via


JsonObject Data type

Version: Available or changed with runtime version 1.0.

Is a container for any well-formed JSON object. A default JsonObject contains an empty JSON object.

Instance methods

The following methods are available on instances of the JsonObject data type.

Method name Description
Add(Text, JsonToken) Adds a new property to a JsonObject.
Add(Text, JsonObject) Adds a new property to a JsonObject.
Add(Text, JsonValue) Adds a new property to a JsonObject.
Add(Text, JsonArray) Adds a new property to a JsonObject.
Add(Text, Boolean) Adds a new property to a JsonObject.
Add(Text, Char) Adds a new property to a JsonObject.
Add(Text, Byte) Adds a new property to a JsonObject.
Add(Text, Option) Adds a new property to a JsonObject.
Add(Text, Integer) Adds a new property to a JsonObject.
Add(Text, BigInteger) Adds a new property to a JsonObject.
Add(Text, Decimal) Adds a new property to a JsonObject.
Add(Text, Duration) Adds a new property to a JsonObject.
Add(Text, Text) Adds a new property to a JsonObject.
Add(Text, Date) Adds a new property to a JsonObject.
Add(Text, Time) Adds a new property to a JsonObject.
Add(Text, DateTime) Adds a new property to a JsonObject.
AsToken() Converts the value in a JsonObject to a JsonToken data type.
Clone() Creates a deep-copy of the JsonToken value.
Contains(Text) Verifies if a JsonObject contains a property with a given key.
Get(Text, var JsonToken) Retrieves the value of a property with a given key from a JsonObject.
Keys() Gets a set of keys of the JsonObject.
Path() Retrieves the JSON path of the object relative to the root of its containing tree.
ReadFrom(Text) Reads the JSON data from the string into a JsonObject variable.
ReadFrom(InStream) Reads the JSON data from the stream into a JsonObject variable.
Remove(Text) Removes the property with the given key from the object.
Replace(Text, JsonToken) Replaces the value of the property with the given key with the new value.
Replace(Text, JsonArray) Replaces the value of the property with the given key with the new value.
Replace(Text, JsonObject) Replaces the value of the property with the given key with the new value.
Replace(Text, JsonValue) Replaces the value of the property with the given key with the new value.
Replace(Text, Boolean) Replaces the value of the property with the given key with the new value.
Replace(Text, Char) Replaces the value of the property with the given key with the new value.
Replace(Text, Byte) Replaces the value of the property with the given key with the new value.
Replace(Text, Integer) Replaces the value of the property with the given key with the new value.
Replace(Text, Option) Replaces the value of the property with the given key with the new value.
Replace(Text, BigInteger) Replaces the value of the property with the given key with the new value.
Replace(Text, Decimal) Replaces the value of the property with the given key with the new value.
Replace(Text, Duration) Replaces the value of the property with the given key with the new value.
Replace(Text, Date) Replaces the value of the property with the given key with the new value.
Replace(Text, Time) Replaces the value of the property with the given key with the new value.
Replace(Text, DateTime) Replaces the value of the property with the given key with the new value.
Replace(Text, Text) Replaces the value of the property with the given key with the new value.
SelectToken(Text, var JsonToken) Selects a JsonToken using a JPath expression.
Values() Gets a set of values of the JsonObject.
WriteTo(var Text) Serializes and writes the JSON data of the JsonObject to a given Text object.
WriteTo(OutStream) Serializes and writes the JSON data of the JsonObject to a given OutStream object.

Note

For performance reasons all HTTP, JSON, TextBuilder, and XML types are reference types, not value types. Reference types holds a pointer to the data elsewhere in memory, whereas value types store its own data.

Remarks

An unitialized variable of JsonObject type represents an empty JSON object. Given a value of JsonObject type, you can check if it is empty by checking that the number of keys in the object is 0.

jsonObject.Keys.Count =  0

Get Started with AL
Developing Extensions