Releases: danielaparker/jsoncons
Release list
Release 1.9.0
-
Fixed bugs:
-
Fixed issue identified by Google fuzz where a CBOR classical multi-dimensional array
contained elements of typed array. -
Git PR #727: fix CBOR parser issues the fuzzer exposed
-
-
Changes
-
The type name
string_sourcehas been deprecated and renamed tochars_source. -
The class
binary_iterator_sourcehas been removed (replaced byiterator_source). -
The type name
order_preserving_policyhas been deprecated and renamed to
ordered_policy. For backwards compatibility the old name is aliased to the new name but
will be removed in a future release. -
The type name
json_conv_traitshas been deprecated and renamed tojson_traits.
For backwards compatibility the old name is aliased to the new name but
will be removed in a future release.
-
-
Enhancements:
-
Until 1.9.0, cbor and msgpack cursors read key-value pairs
and convert the key part into a string before making it
avaliable to the cursor as astaj_events::keyevent .
Since 1.9.0, cbor and msgpack cursors read key-value pairs
and make both string and non-string keys available to the cursor
as a value event ORed with a key flag (staj_events::key_flag).
For backwards compatibility,staj_events::keyis now defined as
staj_events::string_value | staj_events::key_flag. -
For the common case of CBOR or MessagePack unsigned integer keys,
the enum valueidhas been added tosjaj_events,
defined asstaj_events::uint64_value | staj_events::key_flag.cbor::cbor_bytes_cursor cursor{data}; while (!cursor.done()) { switch (cursor.current().event_type()) { case staj_events::id: auto id = cursor.current().get<uint64_t>(); // handle unsigned integer key event break; } } -
When decoding a CBOR or MessagePack array of maps that have unsigned
integer keys, code like
auto m = cbor::decode_cbor<std::vector<std::map<uint64_t, std::string>>>(data);
produces the same result as 1.8.0, but no longer results in conversions
from integer to string and back to integer.-
Reduced allocations when parsing BSON, CBOR, MessagePack and UBJSON.
-
JSONCONS_ALL_MEMBER_TRAITS, JSONCONS_N_MEMBER_TRAITS,
JSONCONS_ALL_MEMBER_NAME_TRAITS, and JSONCONS_N_MEMBER_NAME_TRAITS now
generate decode traits that support decode without an intermediate
basic_jsonvalue.
-
Release 1.8.1
Release 1.8.1
-
Fixed bugs:
- Git PR #717: fix misplaced #endif
Release 1.8.0
-
Fixed bugs:
-
Git PR #716: fix bigdec mantissa and exponent parsing
-
Git Issue #714: json_parser does not stop calling the visitor after visit_* signals an error via std::error_code
-
Git Issue #712/PR #713: quieten GCC 16 (spurious?) array-out-of-bounds warning
-
Git PR #711: Fix staj_event::as_double silently returning 0 for non-numeric strings
-
Git Issue #709: JSONCONS_N_MEMBER_TRAITS silently swallows mandatory-field errors when nested inside an optional parent member
-
Git Issue #702/ PR #703: JMESPath - Merge function can't merge when receiving a json_const_ref
-
Git PR #707: Nested CBOR Parser Fix
-
Git PR #705: JMESPath - Sort and sort_by functions can't sort when receiving a json_const_ref
-
Git PR #704: JMESPath Support rhs expression in multi_select_list
-
Git PR #701: Don't write extra value after some CBOR epoch timestamps
-
Git PR #700: Fix bad multiplier when writing some BSON datetimes
-
Fixed issue with
cbor_encoderencoding of multi-dimensional CBOR typed arrays (withuse_typed_arraystrue.)
-
-
Changes:
-
The types
json_pointer_arg_tandjson_const_pointer_arg_thave been
renamed tojson_ptr_arg_tandconst_json_ptr_arg_t, and the
constantsjson_pointer_argandjson_const_pointer_arghave been
renamed tojson_ptr_argandconst_json_ptr_arg. The old names have been
deprecated and will be removed in a future version. For now they are
aliased to the new names. -
Since 1.8.0, the
basic_jsoncopy constructor makes a deep copy of anyconst_json_ref
andjson_refpointers it may hold. Until 1.8.0, it made a shallow copy. With
this change, thebasic_json::deep_copy()function is no longer needed, and has been
deprecated. -
The (undocumented but sometimes useful) class
basic_json_diagnostics_visitorhas
been renamed tobasic_tracing_json_visitor, and its headerdiagnostics_visitor.hpp
totracing_json_visitor.hpp. Rationale: naming consistency. -
Until 1.8.0, when using the cursor api, it was necessary to supply a custom visitor
to read a CBOR typed array, like this,struct my_cbor_visitor : public default_json_visitor { std::vector<double> v; private: bool visit_typed_array(const span<const double>& data, semantic_tag, const ser_context&, std::error_code&) override { v = std::vector<double>(data.begin(),data.end()); return true; } }; my_cbor_visitor visitor; cursor.read_to(visitor);Since 1.8.0, this will not work,
read_to(visitor)will not result in a call tovisit_typed_array.
Instead, you can simply write,std::vector<double> v; cursor.read_typed_array(v); -
Until 1.8.0, when reading a CBOR multidimensional arrays with typed array or classical array storage,
and serializing to JSON, the result would mimic the CBOR storage, e.g.[[2,3,2], [1,2,3,4,5,6,7,8,9,10,11 12]]]Information about order (row-major or column-major) is lost, and formatting this way
isn't compatible with our sample reflection traits for eigen matrices. Since 1.8.0,
CBOR multidimensional arrays with row-major and column-major typed array storage
and multi-dimensional arrays with row-major classical array storage are serialized
as nested arrays, so the 2 x 3 x 2 3D array above, assuming row-major storage, becomes[[[1,2],[3,4],[5,6]],[[7,8],[9,10],[11,12]]]and with column-major typed array storage,
[[[1,7],[3,9],[5,11]],[[2,8],[4,10],[6,12]]]
-
Enhancements:
-
The following virtual functions have been added to
basic_staj_cursor,
with specializations provided bybasic_cbor_cursor, to support multi-dimensional array input:virtual bool is_mult_dim() const; virtual jsoncons::span<const std::size_t> extents() const; virtual mdarray_order order() const; -
The following virtual functions have been added to
basic_staj_cursor,
with specializations provided bybasic_cbor_cursor, to support
typed array input:virtual bool is_typed_array() const; virtual typed_array_tags array_tag() const; virtual jsoncons::span<uint8_t> array_buffer(); virtual void to_end_array(); -
The following function has been added to
basic_staj_cursorto support
typed array input:template <typename T> void read_typed_array(T& v);
Release 1.7.0
-
Fixed bugs:
-
Changes
- The jsonschema enum class
walk_resulthas been renamed towalk_state.
For backwards compatibility, the old namewalk_resulthas been aliased towalk_state.
- The jsonschema enum class
-
Enhancements:
-
Git Issue #692: The enum
staj_event_typehas been redefined as a BitMask Type,
which means that the bitwise operators operator&, operator|, operator^, operator~, operator&=, operator|=, and operator^=
are now defined for this type. The enum has been renamed tostaj_events, following the convention that
bitmask types have plural names, but aliased back to its original namestaj_event_typefor backwards compatibility.
This allows us to write e.g.constexpr auto mask = staj_events::begin_array | staj_events::begin_object; if ((event_type & mask) != staj_events{}) {/*...*/}
-
The
basic_json_pointeroperator/now accepts abasic_string_viewas a right-hand argument,
and member functionappendnow accepts abasic_string_viewas an argument. -
The class
key_valuehas a new membernamethat returns abasic_string_viewof the key. -
Git Issue #695: Optimized for JMESPath short circuit of or and and operators via PR #698
-
jsonschema validation now supports validation of instances of
jsoncons::pmr::jsonandjsoncons::pmr::ojson.
Note that temporary allocations still usestd::allocator. -
Reduced allocations in jsonschema compilation and validation.
-
Git Discussion #678: "Make json-patches in custom report that will fix validating object", is now supported.
-
The
json_schemafunctionvalidatenow suports providing a reporter that takes an optional user supplied patch as an argument. -
The
json_schemafunctionwalknow suports providing a reporter that takes an optional user supplied patch as an argument.
-
-
Release 1.6.0
-
Fixed bugs:
-
Git PR #673: Fix warning for non clang builds on linux
-
Git Issue #675: std::chrono conversion does not compile with libc++
-
Git PR #679: Fix double colon in url generator
-
Git PR #680: Added missing space after "found" in maximum_validator
-
Git PR #685: optimize semantic_tag::noesc write_string
-
Git PR #687: jmespath: allow rhs_expression in a keyvalue - expression
-
-
Changes:
-
Enhancements
- Added toon-format extension
Release 1.5.0
-
Fixed bugs:
-
Git Issue #644: flatten/unflatten does not preserve arrays with more than 10 elements
-
Git Issue #652: Fixed issue with JSON Schema AdditionalProperties validator
-
Git Issue #653: Fixed issue with non existing default values being added in JSON Schema patch
-
Git Issue #659: Fixed jsonschema validation message
-
Git Issue #664: Fixed issue with detection of CBOR typed arrays that manifested itself on i386
-
Fixed issue with JSON encode option
array_array_split_linesvalueline_split_kind::new_line
not creating a new line -
Fixed issue of JSON encode line split options applied to inner JSON structures
conflicting with line split options applied to outer JSON structures, e.g. when
root line splits are same_line and array within array line splits are multi_line.
With the new behaviour the inner structure will remain same_line if the outer
structure is same_line.
-
-
Changes
-
jsonpointer::unflattennow throws an exception if passed an empty object -
The
err_handlerproperty ofbasic_json_optionshas been deprecated and will
be removed in a future release. Use theallow_trailing_commaandallow_comments
options instead. -
Constructor overloads for
basic_json_parser,basic_json_reader,basic_json_cursor,
basic_csv_parser,basic_csv_readerandbasic_csv_cursorthat take anerr_handler
argument have been deprecated and will be removed in a future release. Use the
allow_trailing_commaandallow_commentsoptions instead. -
The functors
strict_json_parsingandallow_trailing_commashave been deprecated and
will be removed in a future release. Use theallow_trailing_commaandallow_comments
options instead. -
The json_parser option
lossless_bignum, when false, now applies to integer values
as well as floating point values. -
basic_json::is_bignumfunction has been changed to returntrueif the value
is any string value tagged asbigint,bigdec,float128, orbigfloat
(previously onlybigint.) -
basic_jsonhas a functiontype()that returns ajson_typeenumeration,
and the names of its enumerators have been changed.null_value,bool_value,
int64_value,uint64_value,half_value,double_value,string_value,
byte_string_value,array_valueandobject_valuehave been changed to
null,boolean,int64,uint64,float16,float64,string,
byte_string,arrayandobjectrespectively. It's unlikely that we have
many users ofjson_type, it isn't used in any of our examples, but for
backwards compatibility the old names, now deprecated, have been typedef-ed to
the new names. -
The
json_optionsmember nameline_splitshas been renamed toroot_line_spits.
For backwards compatibility, the old name, now deprecated, behaves the same as the
new name.
-
-
Enhancements
-
Git Discussions #594: Updated reflection traits to supports
boost::optional -
Git Discussions #651: Improved
decode_jsonerror messages -
Git PR #647: Allow user configuration of JSONCONS_HAS_STD_FROM_CHARS
-
Git Discussions #654: Added an
indent_charproperty tobasic_json_optionsthat supports tab indents -
Git Discussions #660: Added reflection traits for read/write of enum values as integers.
-
Release 1.4.3
Release 1.4.2
-
Fixed bug:
- Git PR #638: Fixed issue with compiling with
-fno_exceptions
- Git PR #638: Fixed issue with compiling with
Release 1.4.1
This patch fixes some issues reported with v1.4.0
-
Fixed bug:
- Git PR #628: fixed uninitialized warning
- Git Issue #631: Using std::variant with std::unordered_map can throw uncatchable exception
- Git PR #633: Fix make_array() call
- Git Issue #634: Regression in encode_json et al. from v1.3.2 to v1.4.0 with std::variant using std::map
- Git Issue #635: Support construction of sorted_json_object from moved-in pairs
Release 1.4.0
-
Fixed bug:
-
Enhancements:
-
Use
std::from_charsfor chars to double conversion when supported in GCC and VC.
This reverts the removal of this feature in 0.170.0, because of issue std::from_chars parsing fails tests on Windows.
That issue has been addressed. -
New
basic_json_optionsmemberlossless_bignum. Iftrue, reads out of range floating point numbers
as strings with tagsemantic_tag::bigdec. Defaults to true. -
New reflection trait definitions,
jsoncons::reflect::json_conv_traits, that support non-throwing conversions and uses-allocator construction.
These replacejsoncons::json_type_traits, but for backwards compatibility,json_conv_traitsdefaults tojson_type_traitsif a type conversion is undefined. -
New non-throwing versions of the decode functions that return a
std::expected-like result (likestd::expected<T,jsoncons::read_error>),try_decode_jsontry_decode_csvtry_decode_bsontry_decode_cbortry_decode_msgpacktry_decode_ubjson
-
New non-throwing versions of the encode functions that return a
std::expected-like result (likestd::expected<void,jsoncons::write_error>),try_encode_jsontry_encode_csvtry_encode_bsontry_encode_cbortry_encode_msgpacktry_encode_ubjson
-
New non-throwing accessor
try_as<T>()forbasic_jsonthat return astd::expected<T,conversion_error>-like result,
-
-
Changes
-
Until now, the reflection traits generated by the convenience macros
JSONCONS_ALL_MEMBER_TRAITS
etc. produced JSON (or other formats) with object names in sorted order. After this release,
they will produce JSON, BSON etc. with object names in the order that they appear as macro arguments. -
The
allocator_sethelper functionscombine_allocatorsandtemp_allocator_onlyhave been
deprecated and will be removed in a future release. Usemake_alloc_setinstead. -
The
jsoncons::csv::result_options::valueoption has been deprecated and will be removed in a
future release. See What does result_options::value do in json_query()?
for the rationale for this change. Usejsoncons::csv::result_options{}instead. -
basic_json::dumpandencode_jsonoverloads that take ajsoncons::indentingargument have been
deprecated and will be removed in a future release. Use the_prettyoverloads (introduced in 0.155.0)
for prettified output (line indentation.)
-
-
Breaking change to staj iterator classes
- Classes
staj_array_viewandstaj_object_viewand corresponding factoriesstaj_array
andstaj_objecthave been removed. staj_array_iteratorandstaj_object_iteratorobjects are now constructed directly
from a cursor rather than through one of these view objects.- Classes
staj_array_iteratorandstaj_object_iteratornow havebeginandend
non-member functions for range-based for loop support.
We don't expect this change will affect many users. In any case the change is simple, e.g.
auto view = staj_object<std::string,json>(cursor); for (const auto& key_val : view) { // ... }becomes
auto iter = staj_object_iterator<std::string,json>(cursor); for (const auto& key_val : iter) { // ... } - Classes
Release 1.3.2
-
Fixed bug:
- Git Issue #607: Fixed issue with
staj_object_viewandstaj_array_viewiterators that got introduced
as a consequence of a change in 1.3.1
- Git Issue #607: Fixed issue with