Skip to content

Releases: danielaparker/jsoncons

Release 1.4.0

27 Aug 02:57
Compare
Choose a tag to compare
  • Fixed bug:

    • Git PR #628: fixed uninitialized warning

    • Git Issue #622: fixed jmespath issue with uri resolution in patternProperties

    • Git Issue #620: Issue with JSONPath filter expression fixed through PR #621

  • Enhancements:

    • Use std::from_chars for 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_options member lossless_bignum. If true, reads out of range floating point numbers
      as strings with tag semantic_tag::bigdec. Defaults to true.

    • New reflection trait definitions, jsoncons::reflect::json_conv_traits, that support non-throwing conversions and uses-allocator construction.
      These replace jsoncons::json_type_traits, but for backwards compatibility, json_conv_traits defaults to json_type_traits if a type conversion is undefined.

    • New non-throwing versions of the decode functions that return a std::expected-like result (like std::expected<T,jsoncons::read_error>),

      • try_decode_json
      • try_decode_csv
      • try_decode_bson
      • try_decode_cbor
      • try_decode_msgpack
      • try_decode_ubjson
    • New non-throwing versions of the encode functions that return a std::expected-like result (like std::expected<void,jsoncons::write_error>),

      • try_encode_json
      • try_encode_csv
      • try_encode_bson
      • try_encode_cbor
      • try_encode_msgpack
      • try_encode_ubjson
    • New non-throwing accessor try_as<T>() for basic_json that return a std::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_set helper functions combine_allocators and temp_allocator_only have been
      deprecated and will be removed in a future release. Use make_alloc_set instead.

    • The jsoncons::csv::result_options::value option 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. Use jsoncons::csv::result_options{} instead.

    • basic_json::dump and encode_json overloads that take a jsoncons::indenting argument have been
      deprecated and will be removed in a future release. Use the _pretty overloads (introduced in 0.155.0)
      for prettified output (line indentation.)

  • Breaking change to staj iterator classes

    • Classes staj_array_view and staj_object_view and corresponding factories staj_array
      and staj_object have been removed.
    • staj_array_iterator and staj_object_iterator objects are now constructed directly
      from a cursor rather than through one of these view objects.
    • Classes staj_array_iterator and staj_object_iterator now have begin and end
      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)
      {
          // ...
      }
    

Release 1.3.2

13 Apr 18:35
Compare
Choose a tag to compare
  • Fixed bug:

    • Git Issue #607: Fixed issue with staj_object_view and staj_array_view iterators that got introduced
      as a consequence of a change in 1.3.1

Release 1.3.1

09 Apr 13:58
9ccf27f
Compare
Choose a tag to compare
  • Fixed bugs:

    • Git Issue #601: Removed the space before the suffix in the user-defined literal operators _json and _ojson

    • Git Issue #605: Fixed bug when parsing a JMESPath expression that has a function that is passed a binary expression argument, e.g. A || B.

    • In cursors, after a call to read_to following a begin_object event, the cursor event_type() function returned
      staj_event_type::begin_object, even though the effective state of the cursor had changed to staj_event_type::end_object.
      This is fixed. The state of the cursor after a call to next is the same as before.

    • Fixed an edge case in basic_csv_parser, detected by Google fuzz, where the first line in the input file contains an empty line
      and the csv_mapping_kind is n_rows.

  • API Changes:

    • In JMESPath evaluation, 1.3.0 introduced late binding of variables to an initial (global) scope via parameters.
      The parameters type has been changed from std::vector<std::pair<string_type,Json>> to std::map<string_type,Json>.

    • Added a member function begin_position() to ser_context. begin_position() should
      be preferred to position() when using filters to update JSON in place.
      Currently the two accessors return the same value, but that may change in a future release.

    • Added macros JSONCONS_VISITOR_RETURN_TYPE and JSONCONS_VISITOR_RETURN that are
      #define'd to bool and return true respectively. For users that have implemented
      classes that derive from basic_json_filter, and that have overridden visit_xxx functions,
      it is recommended to use these macros for the return type and return value rather than
      bool and return true. This is for forward compatibility.

Release 1.3.0

05 Mar 15:10
Compare
Choose a tag to compare
  • Fixed bugs:

    • Git Issue #600: Added "-Wnull-dereference" to CI and worked around some false positives.

    • Git Issue #597: Invalid json schema compiled successfully

    • Git Issue #595: SIGABRT when serialising unmapped enum value

    • Fixed a jmespath issue with parenthesized expressions involving projections (wildcard expressions,
      the flatten operator, slices and filter expressions) where the right parenthesis did not stop the projection.
      For example, given JSON {"foo" : [[0, 1], [2, 3]]}, the JMESPath query (foo[*])[0]
      returned [0,2] rather than the correct [0,1].

    • Fixed a json_encoder formatting issue when array_object_line_splits option set to line_split_kind::same_line.

  • Implemented new features:

    • JMESPath Lexical Scoping using the new let expression

    • JMESPath evaluation now supports late binding of variables to an initial (global) scope
      via parameters.

    • New json_options members allow_comments and allow_trailing_comma. These options should
      be preferred over using an error handler.

Release 1.2.0

08 Feb 22:36
Compare
Choose a tag to compare
  • Fixed bugs:

    • Git Issue #453: jsonpath length function with recursive select argument gives wrong result
  • Implemented new features:

    • Git issue #556: Support nested JSON to CSV. Add flat, column_mapping, and max_nesting_depth options to basic_csv_options

    • Git issue #585: Add raw_tag() accessor to basic_cbor_cursor. Add functions begin_object_with_tag,
      begin_array_with_tag, uint64_value_with_tag etc. to basic_cbor_encoder to support encoding values with
      raw CBOR tags.

    • Git issue #574: Support custom JSON Schema error messages with errorMessage keyword. Add
      enable_custom_error_message option to evaluation_options.

Release 1.1.0

09 Jan 19:55
Compare
Choose a tag to compare
  • API Changes

    • Reverted changes to basic_json_parser API introduced in 1.0.0, cf Git issue #576
  • Fixed bugs:

    • Git Issue #554: Made headers self-contained

Release 1.0.0

31 Dec 17:00
Compare
Choose a tag to compare
  • API Changes

    • Non-const basic_json::operator[const string_view_type& key] no longer
      returns a proxy type. The rationale for this change is given in Git Issue
      #315. The new behavior for the non-const overload of operator[](const string_view_type& key) is to return a reference to the value that is
      associated with key, inserting a default constructed value with the key
      if no such key already exists, which is consistent with the standard
      library std::map behavior. The new behavior for the const overload of
      operator[](const string_view_type& key) is to return a const reference
      to the value that is associated with key, returning a const reference to
      a default constructed value with static storage duration if no such key
      already exists.

    • Until 1.0.0, a buffer of text is supplied to basic_json_parser with a
      call to update() followed by a call to parse_some(). Once the parser
      reaches the end of the buffer, additional JSON text can be supplied to the
      parser with another call to update(), followed by another call to
      parse_some(). See Incremental parsing (until
      1.0.0)
      .
      Since 0.179, an initial buffer of text is supplied to the parse with a
      call to set_buffer, and parsing commences with a call to parse_some.
      The parser can be constructed with a user provided chunk reader to obtain
      additional JSON text as needed. See Incremental parsing (since
      1.0.0)
      .

    • enum bigint_chars_format is deprecated and replaced by
      bignum_format_kind. Added bignum_format getter and setter functions
      to basic_json_options, and deprecated bigint_format getter and setter
      functions. Changed default bignum_format from
      bigint_chars_format::base10 to bignum_format_kind::raw. Rationale:
      bigint_chars_format was misnamed, as it applied to bigdec as well as
      bigint numbers, and defaulting to bigint_chars_format::base10 produced
      surprising results for users of our lossless number option.

    • The URI argument passed to the jsonschema ResolveURI function object now
      included the fragment part of the URI.

  • Fixed bugs:

    • Git Issue #554: [jsonpath] evaluation throws on json containing json_const_pointer

    • Git PR #560: [jmespath] When there are elements and the sum is indeed zero, avg function should return average value returned instead of a null value.

    • Git Issue #561: json_string_reader does not work correctly for empty string or string with all blanks

    • Git Issue #564: Fixed basic_json compare of double and non-numeric string

    • Git Issue #570: Fixed writing fixed number of map value/value pairs using cbor_encoder and msgpack_encoder

    • Fixed a number of issues in uri::resolve, used in jsonschema, related to abnormal references,
      particulay ones containing dots in path segments.

  • Removed deprecated classes and functions:

    • The jsonschema function make_schema, classes json_validator and validation_output,
      header file json_validator.hpp and example legacy_jsonschema_examples.cpp,
      deprecated in 0.174.0, have been removed.
  • Enhancements:

    • Added stream output operator (<<) to uri class.

    • Added basic_json(json_pointer_arg_t, basic_json* j) constructor to
      allow a basic_json value to contain a non-owning view of another basic_json
      value.

    • Added constant null_arg so that a null json value can be
      constructed with

        json j{jsoncons::null_arg};
    
    • Custom jmespath functions are now supported thanks to PR #560

    • jsonschema now understands the 'uri' and 'uri-reference' formats

Release 0.178.0

31 Oct 13:22
Compare
Choose a tag to compare

Defect fixes:

  • Fixed issue with jmespath::join function through PR #546

  • Fixed issue with the path for cmake config files through PR #547

  • Related to #539, made the basic_json constructor basic_json(const Allocator&)
    consistent with basic_json(json_object_arg_t, const Allocator& alloc = Allocator()).

  • Related to #539, basic_json copy construction now applies allocator traits select_on_container_copy_construction
    to the allocator obtained from other. For pmr allocators, this gives a default constructed pmr allocator rather
    than a copy of the allocator in other.

Enhancements:

  • Improved the implementation of basic_json swap. Previously in some cases it would allocate.

  • Improved the implementation of basic_json copy assignment. Reduced allocations when assigning from array to array and object to
    object.

  • Documented the rules for basic_json allocators here,
    and added numerous tests for conformance to the rules.

  • Added missing basic_json constructor

basic_json(json_array_arg_t, 
    std::size_t count, const basic_json& value, semantic_tag tag = semantic_tag::none, 
    const Allocator& alloc = Allocator());   

Release 0.177.0

16 Aug 15:38
Compare
Choose a tag to compare

Changes

  • Removed deprecated functions and type names identified in #487

  • Reduced the size of some initial json_parser allocations to help with #531

Defect fixes

  • Fixed #528

  • Fixed #530 by making jmespath_expression::evaluate const

  • Fixed #488 related to some standard libraries that don't support strings with stateful allocators.

  • Fixed issue identified in PR #532 with basic_json::compare function

Release 0.176.0

10 Jun 18:44
Compare
Choose a tag to compare

Compiler support

  • Update to Supported compilers
    documentation to reflect the compilers that are currently in continuous integration testing.

  • Support for some ancient compilers, in particular g++ 4.8 and 4.9, has been dropped.

  • Accepted pr #519 to support build with with llvm-toolset-7 on CentOS 7.

  • We (and users) have seen some compilation errors with tests of std::scoped_allocator_adaptor using our sample stateful allocator FreeListAllocator
    in versions of clang predating version 11, and versions of g++ predating version 10. We've therefore excluded these tests when testing with
    the older compilers.

Enhancements

  • basic_json now supports using C++ 17 structured binding, so you can write
for (const auto& [key, value] : j.object_range())
{
    std::cout << key << " => " << value << std::endl;
}
  • Addressed issue #509 of over allocating memory due to alignment constraints through pr #510

jsonschema extension defect fixes:

  • Fixed issue #520 where enabling format validation resulted in a premature abort to validation

  • Addressed issue #521 so that jsonschema now supports big integers

Other defect fixes:

  • Resolved #518 about CUDA and int128 and float 128