A C++, header-only library for constructing JSON and JSON-like data formats, with JSON Pointer, JSON Patch, JSON Schema, JSONPath, JMESPath, CSV, MessagePack, CBOR, BSON, UBJSON
This release contains two breaking changes to recently added features.
Change to jsonpath::get function
jsonpath::get
has been changed from a
pointer to the selected JSON value, or null if not found, to a
std::pair<Json*,bool>
, where the bool component indicates
whether the get operation succeeded.Change to new jsonschema classes and functions introduced in 0.174.0:
json_schema<Json>::validate
that takes a callback
must now be passed a lambda that returns walk_result::advance
or
walk_result::abort
. This supports early exit from validation.Note that this change does not affect the legacy pre-0.174.0 jsonschema
classes and functions (make_schema
, json_validator
).
Enhancement to jsonschema library:
json_schema
member function walk
for walking through the schema.Defect fixes:
nan_to_str
, inf_to_str
and neginf_to_str
Core library enhancements
json_options
line_splits
option that addresses issue #490jsonpath library enhancements
jsonpath::replace
analagous to jsonpointer::replace
,
but for normalized paths.jsonschema library enhancements
The jsonschema extension now supports Drafts 4, 6, 2019-09 and 2020-12 in addition to Draft 07.
New function make_json_schema
that returns a representation of
a compiled JSON Schema document.
New class validation_message
The legacy function make_schema
and classes json_validator
and
validation_output
remain for backward compatibility, but have been
deprecated.
Defect fixes
Fixed issue #485 where basic_json
member names did not use polymorphic_allocator
Addressed issue #482 by replacing static_assert
with runtime exception
Defect fixes:
bigint
and -Werror=stringop-overflow
Defect fixes:
Fixed issue #473 about bigint
and -Werror=stringop-overflow
Fixed jmespath issue #471 about jmespath::search
and ojson
with AddressSanitizer
in macos environment
Fixed jsonpointer issue with json_pointer::parse
for empty string keys (which had implications
for jsonschema definitions
keyword with empty keys.)
Fixed jsonschema issue with definitions
keyword with empty keys
Fixed jsonschema issue #474 about JSON Schema maximum keyword error message
Fixed jsonschema issue with multipleOf
keyword and type integer and multipleOf
a floating point number
Fixed jsonschema issue with the behavior of $id
for rebasing in some keywords, particularly if
, then
, and else
.
Enhancements:
jsonschema::make_schema
functions now support providing a retrieval URI, to initialize the base URI.Defect fixes:
Defect fixes:
Enhancements to jsonpath
Added result_option
sort_descending
.
Added new classes basic_json_location
, basic_path_element
, and basic_path_node
.
Added a new function get
for selecting a single JSON value from a JSON document at
a location represented by a json_location
.
Added a new function remove
for removing a single JSON value from a JSON document at a
location represented by a json_location
.
Added member function select
to jsonpath_expression
.
Added member function select_paths
to jsonpath_expression
.
Added member function update
to jsonpath_expression
, to support
update-in-place for compiled JSONPath expressions.
Enhancements to jsonpointer:
Added free functions to_string
and to_wstring
.
Added append
function to basic_json_pointer
.
Defect fixes:
Fixed issue #441 concerning misaligned allocation for string data.
Fixed issue #436 concerning overflow warning.
Changed internal variable names to avoid shadow warnings
Fixed signature of dump_pretty
#438
Fixed basic_json_decode_options
constructor #437
Enhancements:
Improved error messages (with field names) for invalid type mappings when using the
json_type_traits
convenience macros.
Support char8_t and u8string for C++ 20
Added compare for bigint/bigdec/bigfloat as double or exact text match. This makes
JSON Query work if you use options.lossless_number(true)
for parsing JSON.