fourth, etc. format character represent a value. Any value may be
an object or array, i.e. recursive value building is supported.
+Whitespace, ``:`` and ``,`` are ignored.
+
The following functions compose the value building API:
.. function:: json_t *json_pack(const char *fmt, ...)
``fmt`` may contain objects and arrays as values, i.e. recursive
value extraction is supporetd.
+ .. versionadded:: 2.3
+ Any ``s`` representing a key may be suffixed with a ``?`` to
+ make the key optional. If the key is not found, nothing is
+ extracted. See below for an example.
+
``!``
This special format character is used to enable the check that
all object and array items are accessed, on a per-value basis. It
or object as the last format character before the closing bracket
or brace.
+Whitespace, ``:`` and ``,`` are ignored.
+
The following functions compose the parsing and validation API:
.. function:: int json_unpack(json_t *root, const char *fmt, ...)
json_unpack(root, "[ii!]", &myint1, &myint2);
/* returns -1 for failed validation */
+ /* root is an empty JSON object */
+ int myint = 0, myint2 = 0;
+ json_unpack(root, "{s?i, s?[ii]}",
+ "foo", &myint1,
+ "bar", &myint2, &myint3);
+ /* myint1, myint2 or myint3 is no touched as "foo" and "bar" don't exist */
+
Equality
========