Releases: danielaparker/jsoncons
Release 0.143.1
Bug fix:
- v0.143.1 fixs a bug in the jsonpath filter < comparison operator that was introduced in v0.143.0
Enhancements:
-
j.as<int>(),j.as<uint64_t>()etc. supported for binary, octal and hex string values,
in addition to decimal string values. -
Includes
json_type_traitsspecialization for integer keyed maps, with conversion
to/from string keys in abasic_json. -
The
json_type_traitsspecializations for typeTgenerated by the convenience macros now include a specialization of
is_json_type_traits_declared<T>with member constantvalueequaltrue. -
New
basic_jsonmember functionjson_type type() -
New
basic_jsonmember functionget_value_orthat gets a value as typeTif available,
or a default value if not:template <class T,class U>
T get_value_or(const string_view_type& name, U&& default_value) const;
get_value_or is the preferred alternative to
template<class T>
T get_with_default(const string_view_type& name, const T& default_value) const
Note that get_value_or requires that the first template parameter T be specified explicitly (unlike get_with_default)
Changes:
-
The basic_json
get_with_default(name)function, which returned a const reference
to the value if available and to a json null constant if not,
has been deprecated and renamed toat_or_null(name). Rationale:get_with_default(name)
is more likeat(name)(both return a const reference) than
get_with_default(name,default_value)(which returns a value.) -
The tag type
bstr_arg_thas been renamed tobyte_string_arg_t, and the constant
bstr_argtobyte_string_arg. -
The
cbor_content_handlerpublic member functionstyped_array()and private virtual functions
do_typed_array()have been moved tobasic_json_content_handler. Thedo_typed_array()
private virtual functions have been given default implementations.cbor_content_handler
has been deprecated. -
Replaced Martin Moene's span-lite with simpler implementation until
std::spanis available
(primarily for typed array interface.)
Release 0.142.0
Defect fixes:
- Fixed csv documentation showing the wrong header file includes
- Fixed jsonpath issue json_query() is reordering arrays
- Fixed jsonpath issue with recursive descent reported in
Alignment on JSONPath implementations across languages
Release 0.141.0
Name change:
- The names
JSONCONS_ALL_PROPERTY_TRAITS_DECL,JSONCONS_N_PROPERTY_TRAITS_DECL,
JSONCONS_TPL_ALL_PROPERTY_TRAITS_DECLandJSONCONS_N_PROPERTY_TRAITS_DECL
have been deprecated and renamed toJSONCONS_ALL_GETTER_SETTER_TRAITS_DECL,
JSONCONS_N_GETTER_SETTER_TRAITS_DECL,JSONCONS_TPL_ALL_GETTER_SETTER_TRAITS_DECL
andJSONCONS_TPL_N_GETTER_SETTER_TRAITS_DECL. Rationale: naming consistency.
Enhancements:
- New tag types
json_object_arg_t,json_array_arg_tandbstr_arg_t
have been introduced that make it simpler to constructbasic_jsonvalues
of objects, arrays and byte strings.
Release 0.140.0
Changes to the json_type_traits convenience macros:
- In Issue 190, Twan Springeling
raised an issue with the macroJSONCONS_GETTER_CTOR_TRAITS_DECL, that it did not come
with "strict" and "non-strict" versions. In this release we introduce new macros, where
_N_is mnemonic for the number of mandatory properties provided (possibly zero), and ALL is
mnemonic for all properties are mandatory:
JSONCONS_N_GETTER_CTOR_TRAITS_DECL(class_name,num_mandatory_params,
getter_name0,
getter_name1,...) // (11)
JSONCONS_ALL_GETTER_CTOR_TRAITS_DECL(class_name,
getter_name0,getter_name1,...) // (12)
JSONCONS_TPL_N_GETTER_CTOR_TRAITS_DECL(num_template_params,
class_name,num_mandatory_params,
getter_name0,getter_name1,...) // (13)
JSONCONS_TPL_ALL_GETTER_CTOR_TRAITS_DECL(num_template_params,
class_name,
getter_name0,getter_name1,...) // (14)
JSONCONS_N_GETTER_CTOR_NAMED_TRAITS_DECL(class_name,num_mandatory_params,
(getter_name0,"name0"),
(getter_name1,"name1")...) // (15)
JSONCONS_ALL_GETTER_CTOR_NAMED_TRAITS_DECL(class_name,
(getter_name0,"name0"),
(getter_name1,"name1")...) // (16)
JSONCONS_TPL_N_GETTER_CTOR_NAMED_TRAITS_DECL(num_template_params,
class_name,num_mandatory_params,
(getter_name0,"name0"),
(getter_name1,"name1")...) // (17)
JSONCONS_TPL_ALL_GETTER_CTOR_NAMED_TRAITS_DECL(num_template_params,
class_name,
(getter_name0,"name0"),
(getter_name1,"name1")...) // (18)-
When the traits generated by e.g.
JSONCONS_N_GETTER_CTOR_TRAITS_DECLneed to pass an argument to a
constructor that is not present in the JSON, they pass a default constructed parameter value.
The legacy macros e.g.JSONCONS_GETTER_CTOR_TRAITS_DECLremain, and have the same meaning as before, but are deprecated. -
With the introduction of the
JSONCONS_POLYMORPHIC_TRAITS_DECLmacro,
and the support for polymorhic types, there comes a problem with the "non-strict" macros
JSONCONS_MEMBER_TRAITS_DECL, JSONCONS_PROPERTY_TRAITS_DECL, JSONCONS_SETTER_GETTER_TRAITS_DECL, etc.,
when a class has non-mandatory properties. Type selection is based on the presence of properties,
but thejson_type_traitsgenerated by the non-strict macros don't know which properties are mandatory
and which non-mandatory, hence type selection becomes impossible when members are absent in
the JSON. For this reason, twelve new_N_macros have been introduced to allow you to specify which properties
are mandatory (_N_is mnemonic for number of mandatory properties):
JSONCONS_N_MEMBER_TRAITS_DECL(class_name,num_mandatory_params,
member_name0,member_name1,...)
JSONCONS_TPL_N_MEMBER_TRAITS_DECL(num_template_params,
class_name,num_mandatory_params,
member_name0,member_name1,...)
JSONCONS_N_MEMBER_NAMED_TRAITS_DECL(class_name,num_mandatory_params,
(member_name0,"name0"),
(member_name1,"name1")...)
JSONCONS_TPL_N_MEMBER_NAMED_TRAITS_DECL(num_template_params,
class_name,num_mandatory_params,
(member_name0,"name0"),
(member_name1,"name1")...)
JSONCONS_N_GETTER_CTOR_TRAITS_DECL(class_name,num_mandatory_params,
getter_name0,
getter_name1,...)
JSONCONS_TPL_N_GETTER_CTOR_TRAITS_DECL(num_template_params,
class_name,num_mandatory_params,
getter_name0,getter_name1,...)
JSONCONS_N_GETTER_CTOR_NAMED_TRAITS_DECL(class_name,num_mandatory_params,
(getter_name0,"name0"),
(getter_name1,"name1")...)
JSONCONS_TPL_N_GETTER_CTOR_NAMED_TRAITS_DECL(num_template_params,
class_name,num_mandatory_params,
(getter_name0,"name0"),
(getter_name1,"name1")...)
JSONCONS_N_PROPERTY_TRAITS_DECL(class_name,get_prefix,set_prefix,num_mandatory_params,
property_name0,property_name1,...)
JSONCONS_TPL_N_PROPERTY_TRAITS_DECL(num_template_params,
class_name,get_prefix,set_prefix,num_mandatory_params,
property_name0,property_name1,...)
JSONCONS_N_GETTER_SETTER_NAMED_TRAITS_DECL(class_name,num_mandatory_params,
(getter_name0,setter_name0,"name0"),
(getter_name1,setter_name1,"name1")...)
JSONCONS_TPL_N_GETTER_SETTER_NAMED_TRAITS_DECL(num_template_params,
class_name,num_mandatory_params,
(getter_name0,setter_name0,"name0"),
(getter_name1,setter_name1,"name1")...)-
The legacy non-strict macros remain, and have the same meaning as before, but are deprecated.
-
For consistency with the new naming, and to allow the legacy
JSONCONS_GETTER_CTOR_TRAITS_DECLto
keep the same meaning for backwards compatibility, the_STRICT_names are deprecated
and renamed substituting_ALL_forSTRICT.
See json_type_traits
for complete documentation of the convenience macros.
Release 0.139.0
Enhancements:
- New convenience macro for generating
json_type_traitsfrom getter and setter functions
that will serialize to the stringified property names,
JSONCONS_PROPERTY_TRAITS_DECL(class_name,get_prefix,set_prefix,
property_name0,property_name1,...)
JSONCONS_STRICT_PROPERTY_TRAITS_DECL(class_name,get_prefix,set_prefix,
property_name0,property_name1,...)
JSONCONS_TPL_PROPERTY_TRAITS_DECL(num_template_params,
class_name,get_prefix,set_prefix,
property_name0,property_name1,...)
JSONCONS_TPL_STRICT_PROPERTY_TRAITS_DECL(num_template_params,
class_name,get_prefix,set_prefix,
property_name0,property_name1,...) Release 0.138.0
Defect fix:
- Fixes issue in
csv_parserparsing a CSV file withmapping_kind::m_columns,
when parsing a quoted string containing a numeric value, processing it as a
number rather than as a string.
Changes:
- It is no longer neccessay to place a semicolon after
JSONCONS_TYPE_TRAITS_FRIEND
Enhancements:
- New convenience macro to master for generating
json_type_traitsfor polymorphic types,
based on the presence of properties,
JSONCONS_POLYMORPHIC_TRAITS_DECL(base_class_name,derived_class_name0,derived_class_name1,...) -
The convenience macros
JSONCONS_MEMBER_TRAITS_DECL,JSONCONS_STRICT_MEMBER_TRAITS_DECL,
JSONCONS_TPL_MEMBER_TRAITS_DECL,JSONCONS_TPL_STRICT_MEMBER_TRAITS_DECL,
JSONCONS_MEMBER_TRAITS_NAMED_DECL,JSONCONS_STRICT_MEMBER_TRAITS_NAMED_DECL,
JSONCONS_TPL_MEMBER_TRAITS_NAMED_DECL, andJSONCONS_TPL_STRICT_MEMBER_TRAITS_NAMED_DECL
now allow you to haveconstorstatic constdata members that are serialized. -
basic_csv_encodernow supports json values that map to multi-valued fields and
json objects where each member is a name-array pair. -
basic_csv_parserandbasic_csv_encodernow support nan, infinity,
and minus infinity substitution
Deprecated basic_csv_options functions removed:
- basic_csv_options& column_names(const std::vector<string_type>&)
- basic_csv_options& column_defaults(const std::vector<string_type>& value)
- column_types(const std::vector<string_type>& value)
(Instead, use the versions that take comma-delimited strings)
Release 0.137.0
Defect fixes:
- Fixes GCC 9.2 warning: ‘class jsoncons::json_exception’
has virtual functions and accessible non-virtual destructor,
contributed by KonstantinPlotnikov.
Enhancements:
-
Includes Martin Moene's span-lite to support a C++20-like span in the jsoncons namespace.
-
Includes enhancements to the CBOR encode and decode classes and functions to support the
CBOR extension Tags for Typed Arrays.
The implementation uses the span class.
Changes:
-
The
json_optionsparameter toprecision()has been changed frominttoint8_t -
The
json_optionsparameter toindent_size()has been changed fromsize_ttouint8_t -
The
csv_optionsparameter toprecision()has been changed frominttoint8_t -
The CSV extension enum name
quote_style_typehas been deprecated and renamed toquote_style_kind. -
The CSV extension enum name
mapping_typehas been deprecated and renamed tomapping_kind. -
The
do_virtual functions inbasic_json_content_handlerhave been augmented with astd::error_code
output parameter, e.g.virtual bool do_begin_object(semantic_tag tag, const ser_context& context, std::error_code& ec) = 0;
Release 0.136.1
v0.136.1
Bug fixes:
- This version fixes a defect in the
erasefunctions for
the order preservingbasic_jsonspecializations, in
particular, forojson(issue 188.)
Release 0.136.0
For consistency with other names, the names of the convenience macros below
for classes with templates and JSON with given names have been deprecated.
JSONCONS_MEMBER_TRAITS_NAMED_DECL
JSONCONS_STRICT_MEMBER_TRAITS_NAMED_DECL
JSONCONS_TEMPLATE_MEMBER_TRAITS_DECL
JSONCONS_STRICT_TEMPLATE_MEMBER_TRAITS_DECL
JSONCONS_TEMPLATE_MEMBER_TRAITS_NAMED_DECL
JSONCONS_STRICT_TEMPLATE_MEMBER_TRAITS_NAMED_DECL
JSONCONS_ENUM_TRAITS_NAMED_DECL
JSONCONS_GETTER_CTOR_TRAITS_NAMED_DECL
JSONCONS_TEMPLATE_GETTER_CTOR_TRAITS_DECL
JSONCONS_TEMPLATE_GETTER_CTOR_TRAITS_NAMED_DECL
JSONCONS_GETTER_SETTER_TRAITS_NAMED_DECL
JSONCONS_STRICT_GETTER_SETTER_TRAITS_NAMED_DECL
JSONCONS_TEMPLATE_GETTER_SETTER_TRAITS_NAMED_DECL
JSONCONS_STRICT_TEMPLATE_GETTER_SETTER_TRAITS_NAMED_DECL
They have been renamed to
JSONCONS_MEMBER_NAMED_TRAITS_DECL
JSONCONS_STRICT_MEMBER_NAMED_TRAITS_DECL
JSONCONS_TPL_MEMBER_TRAITS_DECL
JSONCONS_STRICT_TPL_MEMBER_TRAITS_DECL
JSONCONS_TPL_MEMBER_NAMED_TRAITS_DECL
JSONCONS_STRICT_TPL_MEMBER_NAMED_TRAITS_DECL
JSONCONS_ENUM_NAMED_TRAITS_DECL
JSONCONS_GETTER_CTOR_NAMED_TRAITS_DECL
JSONCONS_TPL_GETTER_CTOR_TRAITS_DECL
JSONCONS_TPL_GETTER_CTOR_NAMED_TRAITS_DECL
JSONCONS_GETTER_SETTER_NAMED_TRAITS_DECL
JSONCONS_STRICT_GETTER_SETTER_NAMED_TRAITS_DECL
JSONCONS_TPL_GETTER_SETTER_NAMED_TRAITS_DECL
JSONCONS_STRICT_TPL_GETTER_SETTER_NAMED_TRAITS_DECL
See json_type_traits
Release 0.135.0
New macros that generate the code to specialize json_type_traits from the getter and setter functions
and serialize to given names:
-
JSONCONS_GETTER_SETTER_TRAITS_NAMED_DECL(class_name,(getter_name0,setter_name0,"name0"),(getter_name1,setter_name1,"name1")...) -
JSONCONS_STRICT_GETTER_SETTER_TRAITS_NAMED_DECL(class_name,(getter_name0,setter_name0,"name0"),(getter_name1,setter_name1,"name1")...) -
JSONCONS_TEMPLATE_GETTER_SETTER_TRAITS_NAMED_DECL(num_template_params,class_name,(getter_name0,setter_name0,"name0"),(getter_name1,setter_name1,"name1")...) -
JSONCONS_STRICT_TEMPLATE_GETTER_SETTER_TRAITS_NAMED_DECL(num_template_params,class_name,(getter_name0,setter_name0,"name0"),(getter_name1,setter_name1,"name1")...)
Support for disabling exceptions
- Support compilation with exceptions disabled