Skip to content

Releases: danielaparker/jsoncons

Release 0.162.0

15 Feb 01:14
Compare
Choose a tag to compare

Enhancements to jsonpointer

  • The jsonpointer functions get, add, add_if_absent, and replace
    have an additonal overload with a create_if_missing parameter. If
    passed true, creates key-object pairs when object keys are missing.

Enhancements to jsonpath

  • Improved syntax checking for JSONPath unions
  • Simplified function signatures for make_expression, json_query, and json_replace.

Changes:

  • The jsonpointer function insert has been deprecated and renamed to add_if_absent,
    for consistency with the other names.

Release 0.161.0

08 Feb 15:04
Compare
Choose a tag to compare

The jsoncons::jsonpath extension has been rewritten, see JSONPath extension revisited.

Enhancements to JSONPath extension

  • Added a new function make_expression for creating a compiled JSONPath expression for later evaluation.
  • The json_query and json_replace functions now take an optional result_options parameter that allows duplicate values (i.e. values with
    the same node paths) to be excluded from results, and for results to be sorted in path order.

Changes to json_query

  • The parameter result_type has been replaced by a bitmask type result_options.
    For backwards compatability, result_type has been typedefed to result_options,
    and the value and path enumerators are still there. In addition, result_options
    provides options for excluding duplicates from results, and for results to be sorted in
    path order.

  • Until 0.161.0, json_query was limited to returning an array of results, a copy.
    With 0.161, json_query allows the user to provide a binary callback
    that is passed two arguments - the path of the item and a const reference to the
    original item.

  • Until 0.161.0, json_replace allowed the user to provide a unary callback to replace
    an item in the original JSON with a returned value. This overload is still there, but has
    been deprecated. With 0.161, json_replace allows the user to provide a binary callback
    that is passed two arguments - the path of the item and a mutable reference to the
    original item.

Changes to supported JSONPath syntax

  • Previous versions allowed optionally omitting the '$' representing the root of the
    JSON instance in path selectors. This is no longer allowed. In 0.161.0, all path
    selectors must start with either '$', if relative to the root of the JSON instance,
    or '@', if relative to the current node. E.g. store.book.0 is not allowed,
    rather, $store.book.0.
  • Previous versions supported union of completely separate paths, e.g.
    $..[name.first,address.city]. 0.161.0 does too, but requires that the
    relative paths name.first and address.city start with a '@', so the
    example becomes $..[@.name.first,@.address.city] .
  • Previous versions supported unquoted names with the square bracket notation,
    this is no longer allowed. E.g. $[books] is not allowed, rather $['books']
    or $["books"].
  • Previous versions allowed an empty string to be passed as a path argument
    to json_query. This is no longer allowed, a syntax error will be raised.
  • In 0.161.0, unquoted names in the dot notation are restricted to digits 0-9,
    letters A-Z and a-z, the underscore character _, and unicode coded characters
    that are non-ascii. All others names must be enclosed with single or double quotes.
    In particular, names with hypens (-) must be enclosed with single or double quotes.

Enhancements to JMESPath extension

  • Function arity errors are now raised during compilation of the JMESPath expression
    rather than during evaluation.

Release 0.160.0

19 Jan 02:57
Compare
Choose a tag to compare

Bugs fixed:

  • A C++20 change caused a basic_json overloaded operator '==' to be ambiguous
    despite there being a unique best viable function. Fixed.

  • When parsing MessagePack buffers, lengths were being incorrectly parsed as signed integers. Fixed.

Enhancements:

  • Added jsonschema extension that implements the JSON Schema Draft 7
    specification for validating input JSON, #280

Changes:

  • Until 0.160.0, jsonpointer::flatten, when applied to an
    an empty array or empty object, would produce a flattened value
    of null rather than [] or {}. Since 0.160.0, it will
    produce [] or {}. For example, given {"bar":{},"foo":[]},
    the flattened output was {"/bar":null,"/foo":null}, but is now
    {"/bar":{},"/foo":[]}. jsonpointer::unflatten will now return
    the original object.

Deprecated function removed:

  • The long deprecated basic_json function
    to_string(const basic_json_encode_options<char_type>&, char_allocator_type&) const
    has been removed (replacement is dump).

Release 0.159.0

21 Nov 06:00
Compare
Choose a tag to compare

Bugs fixed:

  • Fixed clang 11 compile issues #284
    and #285.

Changes:

  • In the jsonpointer extension, the type names json_ptr and wjson_ptr have been deprecated and
    renamed to json_pointer and wjson_pointer.

Enhancements:

  • The json_pointer operators /= and / now support integers.

  • New override for jsonpath::json_replace that searches for all values that match a JSONPath expression
    and replaces them with the result of a given function, see #279

  • New factory function jmespath::make_expression to create compiled JMESPath expressions.

0.158.0

08 Oct 14:47
Compare
Choose a tag to compare

Bugs fixed:

  • Fixed compilation error with gcc 11, #276
    (thanks to Laurent Stacul)

Changes:

  • In 0.157.0, the _NAME_ convenience macros were augmented to allow an optional mode parameter
    (JSONCONS_RDWR or JSONCONS_RDONLY) and three optional function object parameters, match (value matches expected),
    from (convert from type known to jsoncons) and into (convert into type known to jsoncons).
    In this release - 0.158.0 - the order of the from and into function object parameters has been reversed.
    If you've provided from and into function objects as arguments in your json traits convenience macros, you'll
    need to reverse their order, or if you've provided just a from function argument, you'll need to precede it
    with jsoncons::identity() (or std::identity() if C++20). For the rationale for this change, see
    #277

  • Conversion errors during decode are now reported more consistently as jsoncons::convert_error,
    parsing errors remain jsoncons::ser_error (or std::error_code) as before.

Release 0.157.2

01 Oct 01:13
Compare
Choose a tag to compare

Warnings fixed:

  • Fixed C20 deprecated move_iterator access with arrow operator.
  • Fixed PVS-Studio warnings

OSS-Fuzz issues fixed:

  • Fixed OSS-Fuzz failed throw issue 25891 affecting decode_ubjson
    and potentially other decode functions. This means that decode
    functions will throw a ser_error instead of an assertion_error
    in the presence of certain kinds of bad data.

Release 0.157.1

26 Sep 23:59
Compare
Choose a tag to compare

Bugs fixed:

  • The macros JSONCONS_ALL_MEMBER_NAME_TRAITS and
    JSONCONS_N_MEMBER_NAME_TRAITS failed at compile time
    when provided with exactly two optional member arguments,
    JSONCONS_RDWR followed by a Match function object
    (other cases were fine.) This has been fixed.

Change reverted:

  • The name change ser_error to codec_error introduced in
    0.157.0 has been reverted back to ser_error. Just in case
    anybody used it, the name codec_error has been typedefed
    to ser_error.

Release 0.157.0

24 Sep 01:03
Compare
Choose a tag to compare

Changes:

  • The name ser_error has been deprecated and renamed to codec_error.

Enhancements:

  • The _NAME_ convenience macros now allow an optional mode parameter
    (JSONCONS_RDWR or JSONCONS_RDONLY) and three function objects,
    match (value matches expected), from (convert from type known to jsoncons)
    and into (convert into type known to jsoncons), #267

Release 0.156.1

17 Sep 19:49
Compare
Choose a tag to compare

Bugs fixed:

  • Fixed issue with jsonpath exception raised when querying empty string, #270

  • Included pull request #273 that fixes an
    issue with a misnamed macro (BOOST_HAS_FLOAT128 instead of JSONCONS_HAS_FLOAT128) introduced in 0.156.0.

Release 0.156.0

26 Aug 01:07
Compare
Choose a tag to compare

Bugs Fixed:

  • Fixed issue with JSONCONS_N_MEMBER_NAME_TRAITS macro, \263

Enhancements:

  • New basic_json(json_const_pointer_arg_t, const basic_json*) constructor to
    allow basic_json values to contain non-owning views of other basic_json
    values.

  • New deep_copy function to make a deep copy of a basic_json value that
    contains non-owning views on other basic_json values.

  • Reduced memory allocations in the jmespath extension using the new
    basic_json(json_const_pointer_arg_t, const basic_json*) constructor.

  • Support for encoding std::bitset into base16 encoded strings (JSON) and
    byte strings (binary formats), and decoding std::bitset from integer values,
    byte strings and base16 encoded strings.

  • Support 128 bit integer types __int128 and unsigned __int128, if supported
    on the platform.