Json.Object
Description: Reference for Json.Object

### Struct

# JsonObject

#### Description [src]

    struct JsonObject {
      /* No available fields */
    }

`JsonObject` is the representation of the object type inside JSON.

A `JsonObject` contains `JsonNode` “members”, which may contain fundamental types, arrays or other objects; each member of an object is accessed using a unique string, or “name”.

Since objects can be arbitrarily big, copying them can be expensive; for this reason they are reference counted. You can control the lifetime of a `JsonObject` using `json_object_ref()` and `json_object_unref()`.

To add or overwrite a member with a given name, use `json_object_set_member()`.

To extract a member with a given name, use `json_object_get_member()`.

To retrieve the list of members, use `json_object_get_members()`.

To retrieve the size of the object (that is, the number of members it has), use `json_object_get_size()`.

#### Constructors

###### json_object_new

Creates a new object.

#### Instance methods

###### json_object_add_member

Adds a new member for the given name and value into an object.

deprecated: 0.8

###### json_object_dup_member

Retrieves a copy of the value of the given member inside an object.

since: 0.6

###### json_object_equal

Check whether `a` and `b` are equal objects, meaning they have the same set of members, and the values of corresponding members are equal.

since: 1.2

###### json_object_foreach_member

Iterates over all members of `object` and calls `func` on each one of them.

since: 0.8

###### json_object_get_array_member

Convenience function that retrieves the array stored in `member_name` of `object`. It is an error to specify a `member_name` which does not exist or which holds a non-`null`, non-array value.

since: 0.8

###### json_object_get_boolean_member

Convenience function that retrieves the boolean value stored in `member_name` of `object`. It is an error to specify a `member_name` which does not exist or which holds a non-scalar, non-`null` value.

since: 0.8

###### json_object_get_boolean_member_with_default

Convenience function that retrieves the boolean value stored in `member_name` of `object`.

since: 1.6

###### json_object_get_double_member

Convenience function that retrieves the floating point value stored in `member_name` of `object`. It is an error to specify a `member_name` which does not exist or which holds a non-scalar, non-`null` value.

since: 0.8

###### json_object_get_double_member_with_default

Convenience function that retrieves the floating point value stored in `member_name` of `object`.

since: 1.6

###### json_object_get_int_member

Convenience function that retrieves the integer value stored in `member_name` of `object`. It is an error to specify a `member_name` which does not exist or which holds a non-scalar, non-`null` value.

since: 0.8

###### json_object_get_int_member_with_default

Convenience function that retrieves the integer value stored in `member_name` of `object`.

since: 1.6

###### json_object_get_member

Retrieves the value of the given member inside an object.

###### json_object_get_members

Retrieves all the names of the members of an object.

###### json_object_get_null_member

Convenience function that checks whether the value stored in `member_name` of `object` is null. It is an error to specify a `member_name` which does not exist.

since: 0.8

###### json_object_get_object_member

Convenience function that retrieves the object stored in `member_name` of `object`. It is an error to specify a `member_name` which does not exist or which holds a non-`null`, non-object value.

since: 0.8

###### json_object_get_size

Retrieves the number of members of a JSON object.

###### json_object_get_string_member

Convenience function that retrieves the string value stored in `member_name` of `object`. It is an error to specify a `member_name` that does not exist or which holds a non-scalar, non-`null` value.

since: 0.8

###### json_object_get_string_member_with_default

Convenience function that retrieves the string value stored in `member_name` of `object`.

since: 1.6

###### json_object_get_values

Retrieves all the values of the members of an object.

###### json_object_has_member

Checks whether `object` has a member named `member_name`.

###### json_object_hash

Calculate a hash value for the given `key` (a JSON object).

since: 1.2

###### json_object_is_immutable

Checks whether the given object has been marked as immutable by calling `json_object_seal()` on it.

since: 1.2

###### json_object_ref

Acquires a reference on the given object.

###### json_object_remove_member

Removes `member_name` from `object`, freeing its allocated resources.

###### json_object_seal

Seals the object, making it immutable to further changes.

since: 1.2

###### json_object_set_array_member

Convenience function for setting an object member with an array value.

since: 0.8

###### json_object_set_boolean_member

Convenience function for setting an object member with a boolean value.

since: 0.8

###### json_object_set_double_member

Convenience function for setting an object member with a floating point value.

since: 0.8

###### json_object_set_int_member

Convenience function for setting an object member with an integer value.

since: 0.8

###### json_object_set_member

Sets the value of a member inside an object.

since: 0.8

###### json_object_set_null_member

Convenience function for setting an object member with a `null` value.

since: 0.8

###### json_object_set_object_member

Convenience function for setting an object member with an object value.

since: 0.8

###### json_object_set_string_member

Convenience function for setting an object member with a string value.

since: 0.8

###### json_object_unref

Releases a reference on the given object.