`JsonNode` can contain fundamental types (integers, booleans, floating point numbers, strings) and complex types (arrays and objects).
When parsing a JSON data stream you extract the root node and walk the node tree by retrieving the type of data contained inside the node
with the `JSON_NODE_TYPE` macro. If the node contains a fundamental type you can retrieve a copy of the `GValue` holding it with the [
[email protected]_value] function, and then use the `GValue` API to extract the data; if the node contains a complex type you can
retrieve the [[email protected]] or the [[email protected]] using [[email protected]_object] or [[email protected]_array]
respectively, and then retrieve the nodes they contain.
A `JsonNode` may be marked as immutable using [[email protected]]. This marks the node and all its descendents as read-only, and
means that subsequent calls to setter functions (such as [[email protected]_array]) on them will abort as a programmer error. By
marking a node tree as immutable, it may be referenced in multiple places and its hash value cached for fast lookups, without the
possibility of a value deep within the tree changing and affecting hash values. Immutable nodes may be passed to functions which retain a
reference to them without needing to take a copy.
A `JsonNode` supports two types of memory management: `malloc`/`free` semantics, and reference counting semantics. The two may be mixed
to a limited extent: nodes may be allocated (which gives them a reference count of 1), referenced one or more times, unreferenced exactly
that number of times (using [[email protected]]), then either unreferenced exactly once more or freed (using [[email protected]])
to destroy them. The [[email protected]] function must not be used when a node might have a reference count not equal to 1. To this
end, JSON-GLib uses [[email protected]] and [[email protected]] internally.