Syntax errors, or any unknown attribute name, terminate the parse.
+One consequence to be aware of is that if an input JSON object
+contains multiple attribute-value pairs with the same attribute,
+the associated storage will be modified each time and only
+the last setting will be effective.
+
=== Simple Value Types ===
The type field of a +json_attr_t+ structure can have the following
+t_character+: Accept a single-character JSON string literal, copy
that character to a C +char+ location.
-+t_time+: Accept a string in the format of an ISO8601 UTC date with
++t_time+: Accept a string in the format of an RFC3339 UTC date with
optional fractional decimal seconds, interpret as seconds since
-the Unix epoch UTC, storte in a C double location..
+the Unix epoch UTC, store in a C double location..
=== Compound Value Types ===
-The following four values do not parse JSON value atoms:
+The following cases do not parse JSON value atoms:
==== Skip fields ====
-t_ignore: Value of this attribute is ignored.
+t_ignore: Value of this attribute is ignored. Significant because
+unexpected attribute names cause the parse to trminate with error
==== Parallel arrays ===
STRUCTARRAY sets up the parser to walk through the array of
structures, filling each element as it goes.
+== The Grubby Details ==
-
-
+You have to specify the shape of the JSON you expect to parse in advance.
The "shape" of a JSON object in the type signature of its
attributes (and attribute values, and so on recursively down through
have a span of multiple specifications with different syntactically
distinguishable types (e.g. string vs. real vs. integer vs. boolean,
but not signed integer vs. unsigned integer). The parser will match
-the right spec against the actual data.
+the right spec against the actual data. (There's an instance
+of this in Example 3.)
-The dialect this parses has some limitations. First, it cannot
-recognize the JSON "null" value. Secondly, arrays may only have
-objects or strings - not reals or integers or floats - as elements
-(this limitation could be easily removed if required). Third, all
-elements of an array must be of the same type.
+ The dialect this parses has some limitations. First, it cannot
+recognize the JSON "null" value. Second, all elements of an array must
+be of the same type. Third, some types (t_time, t_character) may not
+ve array elements (this restriction could be lifted, and might be
+in a future release).
There are separate entry points for beginning a parse of either JSON
object or a JSON array. JSON "float" quantities are actually stored as
supported in this kind of array, as they don't have a "natural" size
to use as an offset multiplier.
- Structobjects arrays are a way to parse a list of objects to a set
+ Structobject arrays are a way to parse a list of objects to a set
of modifications to a corresponding array of C structs. The trick is
that the array object initialization has to specify both the C struct
array's base address and the stride length (the size of the C struct).
The default of array elements is always zero (false for booleans, NULL
for strings).
+
+// end