Releases: danielaparker/jsoncons
Release 0.113.0
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 todecimal_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 injson_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
andarray_object_split_lines
have
been deprecated (still work) and renamed toobject_array_line_splits
,
object_object_line_splits
,array_array_line_splits
andarray_object_line_splits
.
Rationale: consistency withline_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
Changes to json_content_handler
-
The function
byte_string_value
no longer supports passing a byte string ashandler.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 withjson_staj_reader
. -
The name
stream_event_type
has been deprecated and replaced withstaj_event_type
-
The names
basic_stream_event
(stream_event
) have been deprecated and replaced withbasic_staj_event
(staj_event
) -
The names
basic_stream_filter
(stream_filter
) have been deprecated and replaced withbasic_staj_filter
(staj_filter
)
(staj stands for "streaming API for JSON, analagous to StAX in XML) -
The
json_parser
functionend_parse
has been deprecated and replaced withfinish_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 fromjson_content_handler
Release 0.111.1
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
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
andcbor::has_key
have been
deprecated (but still work) and renamed tojson::contains
andcbor::contains
. Rationale: consistency with C++ 20
associative mapcontains
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()
andis_uinteger()
have been deprecated and renamed tois_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
functionaccept
has been changed to
take aconst stream_event&
and aconst serializing_context&
. -
stream_event_type::bignum_value
has been removed.stream_event
now exposes information about optional semantic tagging through
thesemantic_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 havestd::numeric_limits
specializations. In particular,
it supports GCC__int128
andunsigned __int128
when code is
compiled withstd=gnu++NN
, allowing abignum
to be returned as
an__int128
orunsigned __int128
. (when code is compiled with
-std=c++NN
,__int128
andunsigned __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
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 abasic_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 thejson_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
calledjson_event_reader
.) -
json_parser
has new member functionstopped()
. -
The
json::is
function now supportsis<jsoncons::string_view>()
,
and if your compiler hasstd::string_view
,is<std::string_view>()
as well. It returnstrue
if the json value is a string, otherwise
false
. -
The
json::as
function now supportsas<jsoncons::string_view>()
,
and if your compiler hasstd::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
anduinteger_value
have been
changed toint64_value
anduint64_value
. -
The function names
begin_document
andend_document
have been
deprecated. The deprecatedbegin_document
does nothing, and the
deprecatedend_document
callsdo_flush
. -
The function
flush
has been added, which callsdo_flush
. -
The
json
member functiondump_fragment
has been deprecated, as with
the dropping ofbegin_document
andend_document
, it is now
equivalent todump
. -
The function
encode_fragment
has been deprecated, as with
the dropping ofbegin_document
andend_document
, it is now
equivalent toencode_json
. -
The
json_filter
member functiondownstream_handler
has been
renamed todestination_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
anddo_end_document
have been removed.
A virtual functiondo_flush
has been added to allow producers of json events to
flush whatever they've buffered. -
The function names
do_integer_value
anddo_uinteger_value
have been changed to
do_int64_value
anddo_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
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 toexamples_boost
directory. -
Previously, if
json_parser
encountered an unopened object or array, e.g. "1]",
this would cause a JSONCONS_ASSERT failure, resulting in anstd::runtime_error
. This has been
changed to cause ajson_parse_errc::unexpected_right_brace
orjson_parse_errc::unexpected_right_bracket
error code.
Warning fixes
- Eliminated vs2017 level 3 and level 4 warnings
Release 0.108.0
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 tobasic_json
, and values if applied tocbor_view
-
bignum_chars_format::string
has been deprecated (still works) and replaced withbignum_chars_format::base10
-
json_parser_errc
,cbor_parser_errc
, andcsv_parser_errc
have been deprecated (still work) and renamed to
json_parse_errc
,cbor_parse_errc
, andcsv_parse_errc
Release 0.107.2
v0.107.2
Bug fixes:
- Fixed issue with
UINT_MAX
not declared inbignum.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
includingdump
,is<T>
, andas<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
namesbegin_json
andend_json
have been
deprecated and replaced withbegin_document
andend_document
, and the
namesdo_begin_json
anddo_end_json
have been removed and replaced with
do_begin_document
, anddo_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
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
Enhancements
-
The CSV extension now supports multi-valued fields separated by subfield delimiters
-
New functions
decode_json
andencode_json
convert JSON
formatted strings to C++ objects and back. These functions attempt to
perform the conversion by streaming usingjson_convert_traits
, and if
streaming is not supported, fall back to usingjson_type_traits
.decode_json
andencode_json
will work for all types that havejson_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
andbasic_json_output_handler
interfaces have been
combined into one classbasic_json_content_handler
. This greatly simplifies the
implementation ofbasic_json_filter
. Also, the nameparsing_context
has been
deprecated and renamed toserializing_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 thebasic_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 relateddump
free functions have been deprecated,
as their functionality has been subsumed byjson_convert_traits
and the
encode_json
functions. -
The option bool argument to indicate pretty printing in the
json
dump
functions
and thejson_serializer
class has been deprecated. It is replaced by the enum class
indenting
with enumeratorsindenting::no_indent
andindenting::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 thejson_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.