complex JSON values, especially nested objects and arrays. Value
building is based on a *format string* that is used to tell the
functions about the expected arguments.
For example, the format string ``"i"`` specifies a single integer
value, while the format string ``"[ssb]"`` or the equivalent ``"[s, s,
complex JSON values, especially nested objects and arrays. Value
building is based on a *format string* that is used to tell the
functions about the expected arguments.
For example, the format string ``"i"`` specifies a single integer
value, while the format string ``"[ssb]"`` or the equivalent ``"[s, s,
``o`` (any value) [json_t \*]
Output any given JSON value as-is. If the value is added to an
array or object, the reference to the value passed to ``o`` is
``o`` (any value) [json_t \*]
Output any given JSON value as-is. If the value is added to an
array or object, the reference to the value passed to ``o`` is
``O`` (any value) [json_t \*]
Like ``o``, but the argument's reference count is incremented.
``O`` (any value) [json_t \*]
Like ``o``, but the argument's reference count is incremented.
- json_pack("{sisb}", "foo", 42, "bar", 7);
+ json_pack("{sisi}", "foo", 42, "bar", 7);
/* Like above, ':', ',' and whitespace are ignored */
/* Like above, ':', ',' and whitespace are ignored */
- json_pack("{s:i, s:b}", "foo", 42, "bar", 7);
+ json_pack("{s:i, s:i}", "foo", 42, "bar", 7);
/* Build the JSON array [[1, 2], {"cool": true}] */
json_pack("[[i,i],{s:b]]", 1, 2, "cool", 1);
/* Build the JSON array [[1, 2], {"cool": true}] */
json_pack("[[i,i],{s:b]]", 1, 2, "cool", 1);