Struct

JsonArray

Description [src]

struct JsonArray {
  /* No available fields */
}

JsonArray is the representation of the array type inside JSON.

A JsonArray contains JsonNode elements, which may contain fundamental types, other arrays or objects.

Since arrays can be arbitrarily big, copying them can be expensive; for this reason, they are reference counted. You can control the lifetime of a JsonArray using json_array_ref() and json_array_unref().

To append an element, use json_array_add_element().

To extract an element at a given index, use json_array_get_element().

To retrieve the entire array in list form, use json_array_get_elements().

To retrieve the length of the array, use json_array_get_length().

Constructors

json_array_new

Creates a new array.

json_array_sized_new

Creates a new array with n_elements slots already allocated.

Instance methods

json_array_add_array_element

Conveniently adds an array element into an array.

since: 0.8

json_array_add_boolean_element

Conveniently adds the given boolean value into an array.

since: 0.8

json_array_add_double_element

Conveniently adds the given floating point value into an array.

since: 0.8

json_array_add_element

Appends the given node inside an array.

json_array_add_int_element

Conveniently adds the given integer value into an array.

since: 0.8

json_array_add_null_element

Conveniently adds a null element into an array.

since: 0.8

json_array_add_object_element

Conveniently adds an object into an array.

since: 0.8

json_array_add_string_element

Conveniently adds the given string value into an array.

since: 0.8

json_array_dup_element

Retrieves a copy of the element at the given position in the array.

since: 0.6

json_array_equal

Check whether two arrays are equal.

since: 1.2

json_array_foreach_element

Iterates over all elements of an array, and calls a function on each one of them.

since: 0.8

json_array_get_array_element

Conveniently retrieves the array at the given position inside an array.

since: 0.8

json_array_get_boolean_element

Conveniently retrieves the boolean value of the element at the given position inside an array.

since: 0.8

json_array_get_double_element

Conveniently retrieves the floating point value of the element at the given position inside an array.

since: 0.8

json_array_get_element

Retrieves the element at the given position in the array.

json_array_get_elements

Retrieves all the elements of an array as a list of nodes.

json_array_get_int_element

Conveniently retrieves the integer value of the element at the given position inside an array.

since: 0.8

json_array_get_length

Retrieves the length of the given array.

json_array_get_null_element

Conveniently checks whether the element at the given position inside the array contains a null value.

since: 0.8

json_array_get_object_element

Conveniently retrieves the object at the given position inside an array.

since: 0.8

json_array_get_string_element

Conveniently retrieves the string value of the element at the given position inside an array.

since: 0.8

json_array_hash

Calculates a hash value for the given key.

since: 1.2

json_array_is_immutable

Check whether the given array has been marked as immutable by calling json_array_seal() on it.

since: 1.2

json_array_ref

Acquires a reference on the given array.

json_array_remove_element

Removes the element at the given position inside an array.

json_array_seal

Seals the given array, making it immutable to further changes.

since: 1.2

json_array_unref

Releases a reference on the given array.