JsonObject

Represents JSON object.

To parse string into JsonObject use JsonParse.

Instance attributes

Attribute values can be accessed in the same way as instance attribute.

Instance methods

get(key) ⇒ ?

Returns attribute value by the key. Value type depends on the type used in JSON.

Table 1. Parameters

key

String

Attribute key

Return

Attribute value

keys(): Array

Returns attribute array

Return

Attribute array

serialize(): String

Returns string with serialized JSON

Return

String with JSON

set(key, value): void

Sets attribute referenced by key to the given value.

Table 2. Parameters

key

String

Attribute key

value

String

Attribute new value

setBoolean(key, value): void

Sets a boolean value at the specified key. The value is converted to boolean.

Table 3. Parameters

key

String

Attribute key

value

any

Value to convert to boolean

setNull(key): void

Sets a JSON null value at the specified key.

Table 4. Parameters

key

String

Attribute key

setString(key, value): void

Sets a string value at the specified key. The value is converted to string.

Table 5. Parameters

key

String

Attribute key

value

any

Value to convert to string

Constructors

JsonObject()

Creates new JSON object.

Return

JsonObject object

JsonObject(object)

Creates new JSON object with attributes and values from NXSL object or hashmap.

Added in version 5.3

Table 6. Parameters

object

object

NXSL object

Return

JsonObject object