JsonArray

Represents JSON array object.

To parse string into JsonObject use JsonParse.

Instance attributes

size: int

Number of elements in array

values: Array

NXSL array with JSON array elements

Instance methods

append(value): void

Appends value to JSON array.

Table 1. Parameters

value

?

Add value to JSON array. Value type may vary.

get(index) ⇒ ?

Returns array value by the index. Value type depends on the type used in JSON.

Table 2. Parameters

index

Integer

Index of element in array

Return

Attribute value

insert(index, value): void

Sets value to the provided index in JSON array, moving existing element in this position

Table 3. Parameters

index

Integer

Index of element in array

value

?

Add value to JSON array. Value type may vary.

serialize(): String

Returns string with serialized JSON

Return

String with serialized JSON

set(index, value): void

Sets value to the provided index in JSON array, in place of existing element in this position

Table 4. Parameters

index

Integer

Index of element in array

value

?

Add value to JSON array. Value type may vary.

appendBoolean(value): void

Appends a boolean value to the end of the JSON array.

Table 5. Parameters

value

any

Value to convert to boolean

appendNull(): void

Appends a JSON null value to the end of the JSON array.

appendString(value): void

Appends a string value to the end of the JSON array.

Table 6. Parameters

value

any

Value to convert to string

insertBoolean(index, value): void

Inserts a boolean value at the specified index in the JSON array.

Table 7. Parameters

index

Integer

Index to insert at

value

any

Value to convert to boolean

insertNull(index): void

Inserts a JSON null value at the specified index in the JSON array.

Table 8. Parameters

index

Integer

Index to insert at

insertString(index, value): void

Inserts a string value at the specified index in the JSON array.

Table 9. Parameters

index

Integer

Index to insert at

value

any

Value to convert to string

setBoolean(index, value): void

Replaces the value at the specified index with a boolean value.

Table 10. Parameters

index

Integer

Index of element in array

value

any

Value to convert to boolean

setNull(index): void

Replaces the value at the specified index with JSON null.

Table 11. Parameters

index

Integer

Index of element in array

setString(index, value): void

Replaces the value at the specified index with a string value.

Table 12. Parameters

index

Integer

Index of element in array

value

any

Value to convert to string

Constructors

JsonArray()

Creates new JSON array.

Return

JsonArray object

JsonArray(array)

Creates new JSON array object from NXSL array.

Added in version 5.3

Table 13. Parameters

array

array

NXSL array

Return

JsonArray object