There is now a makefile which will produce a libjsonparser static and dynamic library. However, this
is not required to build json-parser, and the source files (json.c and json.h) should be happy
in any build system you already have in place.
json_object (see u.object.length, u.object.values[x].name, u.object.values[x].value)
json_array (see u.array.length, u.array.values)
json_integer (see u.integer)
json_double (see u.dbl)
json_string (see u.string.ptr, u.string.length)
json_boolean (see u.boolean)
json_null
Compile-Time Options
Unless otherwise specified, compile definitions must be provided both when compiling json.c and when compiling any of your own source files that include json.h.
JSON_TRACK_SOURCE
Stores the source location (line and column number) inside each json_value.
This is useful for application-level error reporting.
json_int_t
By default, json_int_t is defined as long under C89 and int_fast64_t otherwise. For MSVC it is defined as __int64 regardless of language standard support.
Optionally, you may define json_int_t to be your own preferred type name for integer types parsed from JSON documents. It must be a signed integer type, there is no support for unsigned types. If you specify a raw primitive type without signed or unsigned (and not a typdef), JSON_INT_MAX will be calculated for you. Otherwise, you must provide your own definition of JSON_INT_MAX as the highest positive integer value that can be represented by json_int_t.
Example usage:
-Djson_int_t=short
"-Djson_int_t=signed char" -DJSON_INT_MAX=127
"-Djson_int_t=long long"
-Djson_int_t=__int128
Runtime Options
settings |= json_enable_comments;
Enables C-style // line and /* block */ comments.
size_t value_extra
The amount of space (if any) to allocate at the end of each json_value, in
order to give the application space to add metadata.
请发表评论