Skip to content

Release 1.8.1

Latest

Choose a tag to compare

@danielaparker danielaparker released this 09 Jun 16:45

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_encoder encoding of multi-dimensional CBOR typed arrays (with use_typed_arrays true.)

  • Changes:

    • The types json_pointer_arg_t and json_const_pointer_arg_t have been
      renamed to json_ptr_arg_t and const_json_ptr_arg_t, and the
      constants json_pointer_arg and json_const_pointer_arg have been
      renamed to json_ptr_arg and const_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_json copy constructor makes a deep copy of any const_json_ref
      and json_ref pointers it may hold. Until 1.8.0, it made a shallow copy. With
      this change, the basic_json::deep_copy() function is no longer needed, and has been
      deprecated.

    • The (undocumented but sometimes useful) class basic_json_diagnostics_visitor has
      been renamed to basic_tracing_json_visitor, and its header diagnostics_visitor.hpp
      to tracing_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 to visit_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 by basic_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 by basic_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_cursor to support
    typed array input:

    template <typename T>
    void read_typed_array(T& v);