Releases: danielaparker/jsoncons
Release 0.98.3.1
0.98.3.1
Fixes an issue with object key comparisons introduced in 0.98.3.
0.98.3
New features
Supports Stefan Goessner's JsonPath. See example below and documentation.
json member function find added
json member function count added
json array range accessor elements() added, which supports range-based for loops over json arrays, and replaces begin_elements and end_elements
json object range accessor members() added, which supports range-based for loops over json objects, and replaces begin_members and end_members
New version of json add member function that takes a parameter array_iterator
json member function shrink_to_fit added
API Changes
The json internal representation of signed and unsigned integers has been changed from long long and unsigned long long to int64_t and uint64_t. This should not impact you unless you've implemented your own json_input_handler or json_output_handler, in which case you'll need to change your json_input_handler function signatures
void do_longlong_value(long long value, const basic_parsing_context& context) override
void do_ulonglong_integer_value(unsigned long long value, const basic_parsing_context& context) override
to
void do_integer_value(int64_t value, const basic_parsing_context& context) override
void do_uinteger_value(uint64_t value, const basic_parsing_context& context) override
and your json_output_handler function signatures from
void do_longlong_value(long long value) override
void do_ulonglong_integer_value(unsigned long long value) override
to
void do_integer_value(int64_t value) override
void do_uinteger_value(uint64_t value) override
output_format drops support for floatfield property
Non-beaking API Changes
remove_range has been deprecated, use erase(array_iterator first, array_iterator last) instead
remove has been deprecated, use erase(const std::string& name ) instead
json::parse_string has been renamed to json::parse, parse_string is deprecated but still works
json member functionis_emptyhas been renamed toempty,is_empty` is deprecated but still works. Rationale: consistency with C++ containers
json member functions begin_elements and end_elements have been deprecated, instead use elements().begin() and elements.end()
json member functions begin_members and end_members have been deprecated, instead use members().begin() and members.end()
json member function has_member has been deprecated, instead use count. Rationale: consistency with C++ containers
json member function remove_member has been deprecated, instead use remove. Rationale: only member function left with _element or _member suffix
json_parse_exception renamed to parse_exception, json_parse_exception typedef to parse_exception
json::parse(std::istream& is) renamed to json::parse_stream. json::parse(std::istream is) is deprecated but still works.
Release 0.98.2.1
0.98.2.1
Fixes an issue with json variant operator=
0.98.2
json constructor is now templated, so constructors now accept extended types
Following RFC7159, json_parser now accepts any JSON value, removing the constraint that it be an object or array.
The member json_type_traits member functions is, as, and assign have been changed to static functions. if you have implemented your own type specializations, you will also have to change your is, as and assign functions to be static.
Removed json deprecated functions custom_data, set_custom_data, add_custom_data
json_reader member function max_depth has been renamed to max_nesting_depth, the former name is still supported.
json member function resize_array has been renamed to resize, the former name is still supported.
jsoncons supports alternative ways for constructing null, object, and array values.
null:
json a = jsoncons::null_type(); // Using type constructor
json b = json::null_type(); // Using alias
json c(json::null); // From static data member prototype
object:
json a(); // Default is empty object
json b = json::object(); // Using type constructor
json c(json::an_object); // From static data member prototype
array:
json a = json::array(); // Using type constructor
json b = json::make_array(); // Using factory method
json c(json::an_array); // From static data member prototype
Since C++ has possible order issues with static data members, the jsoncons examples and documentation have been changed to consistently use the other ways, and json::null, json::an_object and json::an_array have been, while still usable, deprecated.
Release 0.98.1
- Enhances parser for CSV files that outputs JSON, see example below.
- Adds
get_resultmember function tojson_deserializer, which returns the json valuevstored in ajson_deserializerasstd::move(v). Theroot()member function has been deprecated but is still supported. - Adds
is_validmember function tojson_deserializer - Enhances json::any class, adds type checks when casting back to original value
- Fixes some warning messages
Release 0.98
Bug fixes:
- Fixes the noexcept specification (required for Visual Studio 2015 and later.) Fix
contributed by Rupert Steel. - Fixes bug with proxy operator== when comparing object member values,
such as in val["field"] == json("abc")
Enhancements:
- Refines error codes and improves error messages
- Renames
json_readermethodreadtoread_next, reflecting the fact that it supports reading a sequence of JSON texts from a stream. The
former name is deprecated but still works. - Adds
json_readermethodcheck_donethat throws if there are unconsumed non-whitespace characters after one or more calls toread_next. - Adds getter and setter
max_depthmethods to allow setting the maximum JSON parse tree depth if desired, by default
it is arbitrarily large (limited by heap memory.) - Modifies
jsonstatic methodsparse_string,parse_file, andparse_streambehaviour to throw if there are unconsumed non-whitespace characters after reading one JSON text.
Changes to extensions:
- Changes the top level namespace for the extensions from
jsoncons_exttojsoncons, e.g.jsoncons_ext::csv::csv_readerbecomesjsoncons::csv::csv_reader - Modifies csv_reader and csv_serializer so that the constructors are passed parameters in a
csv_parametersobject rather than ajsonobject. - Supports user defined header names for columns in CSV files
Release 0.97.2
-
Incorporates test suite files from http://www.json.org/JSON_checker/ into test suite
-
The
jsonconsparser accepts all of the JSON_checker files that its supposed to accept. -
Failures to reject incorrect exponential notation (e.g. [0e+-1]) have been fixed.
-
The
jsonconsparser now rejects all of the JSON_checker files that its supposed to reject except ones with stuff after the end of the document, e.g.["Extra close"]]
(Currently the
jsonconsparser stops after reading a complete JSON text, and supports reading a sequence of JSON texts.) -
Incorporates a fix to operator== on json objects, contributed by Alex Merry
Release 0.97.1
- "Transforming JSON with filters" example fixed
- Added a class-specific in-place new to the json class that is implemented in terms of the global version (required to create json objects with placement new operator.)
- Reorganized header files, removing unnecessary includes.
- Incorporates validation contributed by Alex Merry for ensuring that there is an object or array on parse head.
- Incorporates fix contributed by Milan Burda for “Switch case is in protected scope” clang build error
Release 0.97
0.97 Release (replaces 0.96)
- Reversion of 0.96 change:
The virtual methods do_float_value, do_integer_value, and do_unsigned_value of json_input_handler and json_outputhandler have been restored to do_double_value, do_longlong_value and do_ulonglong_value, and their typedefed parameter types float_type, integer_type, and unsigned_type have been restored to double, long long, and unsigned long long.
The rationale for this reversion is that the change doesn't really help to make the software more flexible, and that it's better to leave out the typedefs. There will be future enhancements to support greater numeric precision, but these will not affect the current method signatures.
- Fix for "unused variable" warning message
Retains these features from 0.96:
Breaking changes:
- Renamed
error_handlertoparse_error_handler. - Renamed namespace
json_parser_errortojson_parser_errc - Renamed
value_adaptertojson_type_traits, if you have implemented your own type specializations,
you will have to renamevalue_adapteralso. - Only json arrays now support
operator[](size_t)to loop over values, this is no longer supported forjsonobjects. Use a json object iterator instead.
General changes
jsonmember functionbegin_objectnow returns a bidirectional iterator rather than a random access iterator.- Static singleton
instancemethods have been added todefault_parse_error_handler
andempty_json_input_handler. - Added to the
jsonclass overloaded static methods parse, parse_string
and parse_file that take aparse_error_handleras a parameter. - Added methods
last_char()andeof()toparsing_context. - Enhancements to json parsing and json parse event error notification.
- Added to
json_input_handlerandjson_output_handlera non virtual methodvaluethat takes a null terminated string.
Bug fixes:
- Fixed issue with column number reported by json_reader
- Where &s[0] and s.length() were passed to methods, &s[0] has been replaced with s.c_str().
While this shouldn't be an issue on most implementations, VS throws an exception in debug mode when the string has length zero. - Fixes two issues in 0.95 reported by Alex Merry that caused errors with GCC: a superfluous typename has been removed in csv_serializer.hpp, and a JSONCONS_NOEXCEPT specifier has been added to the json_parser_category_impl name method.
- Fixed a number of typename issues in the 0.96 candidate identifed by Ignatov Serguei.
- Fixes issues with testsuite cmake and scons reported by Alex Merry and Ignatov Serguei
Release 0.95.3
- Removed "typename" keyword in csv_serializer.hpp at line 62.
- Added JSONCONS_NOEXCEPT in json_reader.hpp at line 51 (when implementing std::error_category).
- Fixes to testsuite CMake cmake and scons
Release 0.94.1
Release 0.94.1
Bug fixes:
- Incorporates fix from Alex Merry for comparison of json objects
Release 0.94
Bug fixes
- Incorporates contributions from Cory Fields for silencing some compiler warnings
- Fixes bug reported by Vitaliy Gusev in json object operator[size_t]
- Fixes bug in json
is_emptymethod for empty objects
Changes
- json constructors that take string, double etc. are now declared explicit (assignments and defaults to
getandmake_arraymethods have their own implementation and do not depend on implicit constructors.) make_multi_arrayrenamed tomake_array(old name is still supported)- Previous versions supported
anytype values through special methodsset_custom_data,add_custom_data, andcustom_data. This version introduces a new typejson::anythat wrapsanyvalues and works with the usual accessorsset,addandas, so the specialized methods are no longer required.
Enhancements
- json get method with default value now accepts extended types as defaults
- json make_array method with default value now accepts extended types as defaults
New extensions
- Added
jsoncons_ext/boost/type_extensions.hppto collect
extensions traits for boost types, in particular, for
boost::gregoriandates.