decoder: limit max nesting depth
encoding: add link to RFC
decoder: document token lifetime in jsch_decode()
A JSON schema code generator for C.
Check out the example to get started.
Generate C code from a JSON schema:
libjsonschema gen-header schema.json >schema.h
libjsonschema gen-code schema.json >schema.c
libjsonschema will generate one struct per object/array in $defs
. Each
struct comes with 3 functions: foo_encode()
to encode JSON, foo_decode()
to decode JSON and foo_finish()
to release the struct after decoding.
The struct contains different fields depending on the type:
properties
set and additionalProperties
set to false
:
each JSON field generates one C field.properties
unset and additionalProperties
set:
keys
, values
and len
fields are generated containing arrays for the
keys/values and the number of entries.items
set: data
and len
fields are generated containing
an array of values and the number of entries.<stdint.h>
are used when
matched by maximum
and minimum
, otherwise int
is used.bool
, char *
, double
are used.struct jsch_raw_value
is generated to delay decoding.Report bugs on the issue tracker, send patches on the mailing list.
MIT