Skip to content

Releases: danielaparker/jsoncons

Release 0.113.0

20 Nov 22:31
Compare
Choose a tag to compare

Bug fix

  • Fixed issue with indefinite length byte strings, text strings, arrays,
    and maps nested inside other CBOR items (wasn't advancing the
    input pointer past the "break" indicator.)

Changes

  • FILE and LINE macros removed from JSONCONS_ASSERT
    if not defined _DEBUG (contributed by zhskyy.)

  • semantic_tag_type name decimal changed to decimal_fraction

New CBOR feature

  • CBOR semantic tagging of expected conversion of byte strings
    to base64, base64url and base16 are preserved and respected in JSON
    serialization (unless overridden in json_serializing_options.)

  • CBOR semantic tagging of bigfloat preserved with semantic_tag_type::bigfloat

  • CBOR non text string keys converted to strings when decoding
    to json values

Changes to json_serializing_options

New options

  • spaces_around_colon (defaults to space_after)
  • spaces_around_comma (defaults to space_after)
  • pad_inside_object_braces (defaults to false)
  • pad_inside_array_brackets (defaults to false)
  • line_length_limit (defaults to '120`)
  • new_line_chars (for json serialization, defaults to \n)

nan_replacement, pos_inf_replacement, and neg_inf_replacement are deprecated (still work)
These have been replaced by

  • nan_to_num/nan_to_str
  • inf_to_num/inf_to_str
  • neginf_to_num/neginf_to_str (default is - followed by inf_to_num/inf_to_str)

nan_to_str, inf_to_str and neginf_to_str are also used to substitute back to nan, inf and neginf in the parser.

  • Long since deprecated options array_array_block_option,
    array_object_block_option, object_object_block_option and
    object_array_block_option have been removed.

  • The names object_array_split_lines, object_object_split_lines,
    array_array_split_lines and array_object_split_lines have
    been deprecated (still work) and renamed to object_array_line_splits,
    object_object_line_splits, array_array_line_splits and array_object_line_splits.
    Rationale: consistency with line_split_kind name.

Changes to json_serializer

  • Previously the constructor of json_serializer took an optional argument to
    indicate whether "indenting" was on. json_serializer now always produces
    indented output, so this argument has been removed.

  • A new class json_compressed_serializer produces compressed json without
    indenting.

    The jsoncons functions that perform serialization including json::dump,
    pretty_print and the output stream operator are unaffected.

Release 0.112

11 Nov 19:03
Compare
Choose a tag to compare

Changes to json_content_handler

  • The function byte_string_value no longer supports passing a byte string as

    handler.byte_string_value({'b','a','r'});

(shown in some of the examples.) Instead use

handler.byte_string_value(byte_string({'b','a','r'}));

(or a pointer to utf8_t data and a size.)

  • The function bignum_value no longer supports passing a CBOR signum and
    byte string, bignum_value now accepts only a string view. If you
    have a CBOR signum and byte string, you can use the bignum class to
    convert it into a string.

Name changes (non breaking)

  • The name json_stream_reader has been deprecated and replaced with json_staj_reader.

  • The name stream_event_type has been deprecated and replaced with staj_event_type

  • The names basic_stream_event (stream_event) have been deprecated and replaced with basic_staj_event (staj_event)

  • The names basic_stream_filter (stream_filter) have been deprecated and replaced with basic_staj_filter (staj_filter)
    (staj stands for "streaming API for JSON, analagous to StAX in XML)

  • The json_parser function end_parse has been deprecated and replaced with finish_parse.

Enhancements

  • json double values convert to CBOR float if double to float
    round trips.

  • csv_parser ignore_empty_values option now applies to
    m_columns style json output.

  • json_reader and json_staj_reader can be initialized with strings
    in addition to streams.

Extension of semantic tags to other values

- The `json_content_handler` functions `do_null_value`, `do_bool_value`,
  `do_begin_array` and `do_begin_object` have been given the
  semantic_tag_type parameter.  

- New tag type `semantic_tag_type::undefined` has been added

- The `cbor_parser` encodes a CBOR undefined tag to a json null
  value with a `semantic_tag_type::undefined` tag, and the 
  `cbor_serializer` maps that combination back to a CBOR undefined tag. 

Removed:

  • Long since deprecated value() functions have been removed from json_content_handler

Release 0.111.1

28 Oct 15:37
Compare
Choose a tag to compare

Improvements

  • Improved efficiency of json_decoder

  • Improved efficiency of json_proxy

  • Conversion of CBOR decimal fraction to string uses exponential
    notation if exponent is positive or if the exponent plus the
    number of digits in the mantissa is negative.

Bug fix

  • Fixed issue with conversion of CBOR decimal fraction to string
    when mantissa is negative

Release 0.111.0

19 Oct 15:04
Compare
Choose a tag to compare

Bug and warning fixes:

  • A case where the json parser performed validation on a string
    before all bytes of the string had been read, and failed if
    missing part of a multi-byte byte sequence, is fixed.

  • An issue with reading a bignum with the pull parser
    json_stream_reader (in the case that an integer value
    overflows) has been fixed.

  • GCC and clang warnings about switch fall through have
    been fixed

Non-breaking changes:

  • The functions json::has_key and cbor::has_key have been
    deprecated (but still work) and renamed to json::contains
    and cbor::contains. Rationale: consistency with C++ 20
    associative map contains function.

  • The json function as_integer() is now a template function,

template <class T = int64_t>
T as_integer();

where T can be any integral type, signed or unsigned. The
default parameter is for backwards compatability, but is
a depreated feature, and may be removed in a future version.
Prefer j.as<int64_t>().

  • The json functions is_integer() and is_uinteger()
    have been deprecated and renamed to is_int64(), is_uint64().
    Prefer j.is<int64_t>() and j.is<uint64_t>().

  • The json function as_uinteger() has been deprecated.
    Prefer j.as<uint64_t>().

and as_uinteger() have been deprecated and renamed to
is_int64(), is_uint64(), as_int64() and as_uint64().

Change to pull parser API:

  • The stream_filter function accept has been changed to
    take a const stream_event& and a const serializing_context&.

  • stream_event_type::bignum_value has been removed. stream_event
    now exposes information about optional semantic tagging through
    the semantic_tag() function.

Enhancements:

  • j.as<bignum>() has been enhanced to return a bignum value
    if j is an integer, floating point value, or any string that
    contains an optional minus sign character followed by a sequence
    of digits.

  • j.as<T>() has been enhanced to support extended integer
    types that have std::numeric_limits specializations. In particular,
    it supports GCC __int128 and unsigned __int128 when code is
    compiled with std=gnu++NN, allowing a bignum to be returned as
    an __int128 or unsigned __int128. (when code is compiled with
    -std=c++NN, __int128 and unsigned __int128 do not have
    std::numeric_limits specializations.)

New feature:

This release accomodate the additional semantics for the
CBOR data items date-time (a string), and epoch time (a positive or
negative integer or floating point value), and decimal fraction
(converted in the jsoncons data model to a string).

But first, some of the virtual functions in json_content_handler
have to be modified to preserve these semantics. Consequently,
the function signatures

bool do_int64_value(int64_t, const serializing_context&)

bool do_uint64_value(uint64_t, const serializing_context&)

bool do_double_value(double, const floating_point_options&, const serializing_context&)

bool do_string_value(const string_view_type&, const serializing_context&)

bool do_byte_string_value(const uint8_t*, size_t, const serializing_context&)

have been gifted an additonal parameter, a semantic_tag_type,

bool do_int64_value(int64_t, semantic_tag_type, const serializing_context&)

bool do_uint64_value(uint64_t, semantic_tag_type, const serializing_context&)

bool do_double_value(double, const floating_point_options&, semantic_tag_type, const serializing_context&)

bool do_string_value(const string_view_type&, semantic_tag_type, const serializing_context&)

bool do_byte_string_value(const uint8_t*, size_t, semantic_tag_type, const serializing_context&)

For consistency, the virtual function

bool do_bignum_value(const string_view_type&, const serializing_context&)

has been removed, and in its place do_string_value will be called
with semantic_tag_type::bignum_type.

For users who have written classes that implement all or part of
json_content_handler, including extensions to json_filter,
these are breaking changes. But otherwise users should be unaffected.

Release 0.110.3

05 Oct 19:55
Compare
Choose a tag to compare

v0.110.3

Bug fix:

This patch fixes a case where the json parser performed validation on a string
before all bytes of the string had been read, and failing if missing part of a
multi-byte byte sequence.

v0.110.2

Continuous integration:

  • jsoncons is now cross compiled for ARMv8-A architecture on Travis using
    clang and executed using the emulator qemu.

  • UndefinedBehaviorSanitizer (UBSan) is enabled for selected gcc and clang builds.

Maintenance:

  • Removed compiler warnings

v0.110.1

Bug fixes contributed by Cebtenzzre

  • Fixed a case where as_double(), as_integer() etc on a basic_json
    value led to an infinite recursion when the value was a bignum

  • Fixed undefined behavior in bignum class

v0.110.0

New features

  • A JSON pull parser, json_stream_reader, has been added. This
    required a change to the json_content_handler function signatures,
    the return values has been changed to bool, to indicate whether
    parsing is to continue. (An earlier version on master was
    called json_event_reader.)

  • json_parser has new member function stopped().

  • The json::is function now supports is<jsoncons::string_view>(),
    and if your compiler has std::string_view, is<std::string_view>()
    as well. It returns true if the json value is a string, otherwise
    false.

  • The json::as function now supports as<jsoncons::string_view>(),
    and if your compiler has std::string_view, as<std::string_view>()
    as well.

Changes to json_content_handler and related streaming classes

Non-breaking changes

These changes apply to users that call the public functions defined by
json_content_handler, e.g. begin_object, end_object, etc., but are
non-breaking because the old function signatures, while deprecated,
have been preserved. Going forward, however, users should remove
calls to begin_document, replace end_document with flush,
and replace integer_value and end_integer_value with int64_value
and uint64_value.

  • The public functions defined by json_content_handler have been changed
    to return a bool value, to indicate whether parsing is to continue.

  • The function names integer_value and uinteger_value have been
    changed to int64_value and uint64_value.

  • The function names begin_document and end_document have been
    deprecated. The deprecated begin_document does nothing, and the
    deprecated end_document calls do_flush.

  • The function flush has been added, which calls do_flush.

  • The json member function dump_fragment has been deprecated, as with
    the dropping of begin_document and end_document, it is now
    equivalent to dump.

  • The function encode_fragment has been deprecated, as with
    the dropping of begin_document and end_document, it is now
    equivalent to encode_json.

  • The json_filter member function downstream_handler has been
    renamed to destination_handler.

Breaking changes

These changes will affect users who have written classes that implement
all or part of json_content_handler, including extensions to json_filter.

  • The virtual functions defined for json_content_handler, do_begin_object,
    do_end_object, etc. have been changed to return a bool value, to indicate
    whether serializing or deserializing is to continue.

  • The virtual functions do_begin_document and do_end_document have been removed.
    A virtual function do_flush has been added to allow producers of json events to
    flush whatever they've buffered.

  • The function names do_integer_value and do_uinteger_value have been changed to
    do_int64_value and do_uint64_value.

  • The signature of do_bignum_value has been changed to

    bool do_bignum_value(const string_view_type& value, 
                         const serializing_context& context)

Release 0.109.0

30 Aug 03:46
Compare
Choose a tag to compare

Enhancements

  • Added byte string formatting option byte_string_chars_format::base16

Changes

  • Scons dropped as a build system for tests and examples, use CMake

  • Tests no longer depend on boost, boost test framework replaced by Catch2.
    boost code in tests moved to examples_boost directory.

  • Previously, if json_parser encountered an unopened object or array, e.g. "1]",
    this would cause a JSONCONS_ASSERT failure, resulting in an std::runtime_error. This has been
    changed to cause a json_parse_errc::unexpected_right_brace or json_parse_errc::unexpected_right_bracket error code.

Warning fixes

  • Eliminated vs2017 level 3 and level 4 warnings

Release 0.108.0

31 Jul 17:52
Compare
Choose a tag to compare

v0.108.0

Enhancements

  • bignum_chars_format::base64 is supported

  • The incremental parser json_parser has been documented

Changes (non-breaking)

  • Previously, jsonpointer::get returned values (copies)
    Now, jsonpointer::get returns references if applied to basic_json, and values if applied to cbor_view

  • bignum_chars_format::string has been deprecated (still works) and replaced with bignum_chars_format::base10

  • json_parser_errc, cbor_parser_errc, and csv_parser_errc have been deprecated (still work) and renamed to
    json_parse_errc, cbor_parse_errc, and csv_parse_errc

Release 0.107.2

26 Jul 19:07
Compare
Choose a tag to compare

v0.107.2

Bug fixes:

  • Fixed issue with UINT_MAX not declared in bignum.hpp

v0.107.1

Bug fixes:

  • Fixed issue with cbor_view iterators over indefinite length arrays and maps

Enhancements:

  • csv_serializer recognizes byte strings and bignums.

v0.107.0

Enhancements

  • Support for CBOR bignums
  • Added json serializing options for formatting CBOR bignums as integer, string, or base64url encoded byte string
  • Added json serializing options for formatting CBOR bytes strings as base64 or base64url
  • Enhanced interface for cbor_view including dump, is<T>, and as<t> functions

Changes

  • If the json parser encounters an integer overflow, the value is now handled as a bignum rather than a double value.

  • The json_content_handler names begin_json and end_json have been
    deprecated and replaced with begin_document and end_document, and the
    names do_begin_json and do_end_json have been removed and replaced with
    do_begin_document, and do_end_document.
    Rationale: meaningfullness across JSON and other data formats including
    CBOR.

Bug fixes:

  • Fixed bug in base64url encoding of CBOR byte strings
  • Fixed bug in parsing indefinite length CBOR arrays and maps

Release 0.106.0

10 Jul 04:33
Compare
Choose a tag to compare

v0.106.0

Changes

  • If a fractional number is read in in fixed format, serialization now preserves
    that fixed format, e.g. if 0.000071 is read in, serialization gives 0.000071
    and not 7.1e-05. In previous versions, the floating point format, whether
    fixed or scientific, was determined by the behavior of snprintf using the g
    conversion specifier.

Bug fix:

  • Fixed issue with parsing cbor indefinite length arrays and maps

Warning fix:

  • Use memcpy in place of reinterpret_cast in binary data format utility
    from_big_endian

Compiler fix:

  • Fixed issues with g++ 4.8

Release 0.105.0

25 May 11:25
Compare
Choose a tag to compare

Enhancements

  • The CSV extension now supports multi-valued fields separated by subfield delimiters

  • New functions decode_json and encode_json convert JSON
    formatted strings to C++ objects and back. These functions attempt to
    perform the conversion by streaming using json_convert_traits, and if
    streaming is not supported, fall back to using json_type_traits. decode_json
    and encode_json will work for all types that have json_type_traits defined.

  • The json::parse functions and the json_parser and json_reader constructors
    optionally take a json_serializing_options parameter, which allows replacing
    a string that matches nan_replacement(), pos_inf_replacement(), and neg_inf_replacement().

Changes to Streaming

  • The basic_json_input_handler and basic_json_output_handler interfaces have been
    combined into one class basic_json_content_handler. This greatly simplifies the
    implementation of basic_json_filter. Also, the name parsing_context has been
    deprecated and renamed to serializing_context, as it now applies to both
    serializing and deserializing.

    If you have subclassed json_filter or have fed JSON events directlty to a
    json_serializer, you shouldn't have to make any changes. In the less likely
    case that you've implemented the basic_json_input_handler or
    basic_json_output_handler interfaces, you'll need to change that to
    json_content_handler.

Other Changes

  • serialization_traits and the related dump free functions have been deprecated,
    as their functionality has been subsumed by json_convert_traits and the
    encode_json functions.

  • The option bool argument to indicate pretty printing in the json dump functions
    and the json_serializer class has been deprecated. It is replaced by the enum class
    indenting with enumerators indenting::no_indent and indenting::indent.

  • The name serialization_options has been deprecated (still works) and renamed to
    json_serializing_options. Rationale: naming consistency.

  • The json_reader max_nesting_depth getter and setter functions have been deprecated.
    Use the json_serializing_options max_nesting_depth getter and setter functions instead.

  • The name csv_parameters has been deprecated (still works) and renamed to
    csv_serializing_options. Rationale: naming consistency.