You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
defined. jsoncons already supports many types in the standard library,
1610
-
and your own types will be supported too if you specialize `json_traits`
1611
-
in the `jsoncons::reflect` namespace.
1612
-
1610
+
and your own types will be supported too if you specialize [json_conv_traits](./ref/corelib/reflect/json_conv_traits.md)
1611
+
(since 1.4.0, rename to json_traits in 1.9.0) or [json_type_traits](./ref/corelib/legacy_reflect/json_type_traits.md).
1613
1612
1614
1613
```cpp
1615
1614
#include <iostream>
@@ -1628,7 +1627,7 @@ namespace jsoncons {
1628
1627
namespace reflect {
1629
1628
1630
1629
template <typename Json>
1631
-
struct json_traits<Json, ns::book> // since 1.9.0, use json_conv_traits until 1.9.0
1630
+
struct json_traits<Json, ns::book> // since 1.9.0
1632
1631
{
1633
1632
using allocator_type = Json::allocator_type;
1634
1633
using result_type = conversion_result<ns::book>;
@@ -1754,7 +1753,7 @@ Charles Bukowski, Pulp, 22.48
1754
1753
1755
1754
#### Serialize non-mandatory std::optional values using the convenience macros
1756
1755
1757
-
The jsoncons library includes a [json_type_traits](ref/json_type_traits/json_type_traits.md) specialization for
1756
+
The jsoncons library includes a [reflection traits](./ref/corelib/reflection-traits.md) specialization for
1758
1757
`jsoncons::optional<T>` if `T` is also specialized. `jsoncons::optional<T>` is aliased to
1759
1758
[std::optional<T>](https://en.cppreference.com/w/cpp/utility/optional) if
1760
1759
jsoncons detects the presence of C++17, or if `JSONCONS_HAS_STD_OPTIONAL` is defined.
@@ -1859,7 +1858,7 @@ Output:
1859
1858
1860
1859
#### An example with std::shared_ptr and std::unique_ptr
1861
1860
1862
-
The jsoncons library includes [json_type_traits](ref/json_type_traits/json_type_traits.md) specializations for
1861
+
The jsoncons library includes [reflection traits](./ref/corelib/reflection-traits.md) specializations for
1863
1862
`std::shared_ptr<T>` and `std::unique_ptr<T>` if `T` is not a [polymorphic class](https://en.cppreference.com/w/cpp/language/object#Polymorphic_objects),
1864
1863
i.e., does not have any virtual functions, and if `T` is also specialized. Empty `std::shared_ptr<T>` and `std::unique_ptr<T>` values correspond to JSON null.
1865
1864
In addition, users can implement `json_type_traits` for `std::shared_ptr` and `std::unique_ptr`
@@ -1983,7 +1982,7 @@ int main()
1983
1982
1984
1983
This example makes use of the convenience macros `JSONCONS_ENUM_TRAITS`
1985
1984
and `JSONCONS_ALL_CTOR_GETTER_TRAITS` to specialize the
1986
-
[json_type_traits](ref/json_type_traits/json_type_traits.md) for the enum type
1985
+
[reflection traits](./ref/corelib/reflection-traits.md) for the enum type
1987
1986
`ns::hiking_experience` and the classes `ns::hiking_reputon` and
1988
1987
`ns::hiking_reputation`.
1989
1988
The macro `JSONCONS_ENUM_TRAITS` generates the code from
@@ -2110,7 +2109,7 @@ Marilyn C, 0.9, 1514862245
2110
2109
#### Serialize a polymorphic type based on the presence of members
2111
2110
2112
2111
This example uses the convenience macro `JSONCONS_N_CTOR_GETTER_TRAITS`
2113
-
to generate the [json_type_traits](ref/json_type_traits/json_type_traits.md) boilerplate for the `HourlyEmployee` and `CommissionedEmployee`
2112
+
to generate the [reflection traits](./ref/corelib/reflection-traits.md) boilerplate for the `HourlyEmployee` and `CommissionedEmployee`
2114
2113
derived classes, and `JSONCONS_POLYMORPHIC_TRAITS` to generate the `json_type_traits` boilerplate
2115
2114
for `std::shared_ptr<Employee>` and `std::unique_ptr<Employee>`. The type selection strategy is based
2116
2115
on the presence of mandatory members, in particular, to the `firstName`, `lastName`, and `wage` members of an
@@ -3023,7 +3022,7 @@ we use the function object `ns::rectangle_marker` to ouput the value
3023
3022
this position cannot be a lambda expression (at least until C++20),
3024
3023
because jsoncons uses it in an unevaluated context, so it is
3025
3024
provided as a variable containing a lambda expression instead.
3026
-
See [convenience macros](ref/json_type_traits/reflect/reflect-traits-gen.md)
3025
+
See [convenience macros](./ref/corelib/legacy_reflect/reflect/reflect-traits-gen.md)
3027
3026
for full details.
3028
3027
3029
3028
<divid="G13"/>
@@ -3609,10 +3608,10 @@ Output:
3609
3608
3610
3609
#### Merge two json objects
3611
3610
3612
-
[json::merge](ref/json/merge.md) inserts another json object's key-value pairs into a json object,
3611
+
[json::merge](./ref/corelib/json/merge.md) inserts another json object's key-value pairs into a json object,
3613
3612
unless they already exist with an equivalent key.
3614
3613
3615
-
[json::merge_or_update](ref/json/merge_or_update.md) inserts another json object's key-value pairs
3614
+
[json::merge_or_update](./ref/corelib/json/merge_or_update.md) inserts another json object's key-value pairs
3616
3615
into a json object, or assigns them if they already exist.
3617
3616
3618
3617
The `merge` and `merge_or_update` functions perform only a one-level-deep shallow merge,
@@ -3796,7 +3795,7 @@ Output:
3796
3795
3797
3796
#### Search for and repace an object member key
3798
3797
3799
-
You can rename object members with the built in filter [rename_object_key_filter](ref/rename_object_key_filter.md)
3798
+
You can rename object members with the built in filter [rename_object_key_filter](./ref/corelib/rename_object_key_filter.md)
Copy file name to clipboardExpand all lines: doc/Pages/index.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,7 +29,7 @@ to work with the data in a number of ways:
29
29
30
30
- As a variant-like data structure, [basic_json](https://github.com/danielaparker/jsoncons/blob/master/doc/ref/corelib/basic_json.md)
31
31
32
-
- As a strongly typed C++ data structure that implements [json_type_traits](https://github.com/danielaparker/jsoncons/blob/master/doc/ref/corelib/json_type_traits/json_type_traits.md)
32
+
- As a strongly typed C++ data structure that implements [json_type_traits](https://github.com/danielaparker/jsoncons/blob/master/doc/ref/corelib/legacy_reflect/json_type_traits.md)
33
33
34
34
- With [cursor-level access](https://github.com/danielaparker/jsoncons/blob/doc/doc/ref/corelib/basic_json_cursor.md) to a stream of parse events, somewhat analogous to StAX pull parsing and push serializing
35
35
in the XML world.
@@ -38,7 +38,7 @@ Compared to other JSON libraries, jsoncons has been designed to handle very larg
38
38
SAX-style parsers and serializers. It supports reading an entire JSON text in memory in a variant-like structure.
39
39
But it also supports efficient access to the underlying data using StAX-style pull parsing and push serializing.
40
40
And it supports incremental parsing into a user's preferred form, using
41
-
information about user types provided by specializations of [json_type_traits](doc/ref/corelib/json_type_traits/json_type_traits.md).
41
+
information about user types provided by specializations of [json_type_traits](doc/ref/corelib/legacy_reflect/json_type_traits.md).
42
42
43
43
The [jsoncons data model](https://github.com/danielaparker/jsoncons/blob/master/doc/ref/corelib/data-model.md) supports the familiar JSON types - nulls,
44
44
booleans, numbers, strings, arrays, objects - plus byte strings. In addition, jsoncons
@@ -75,7 +75,7 @@ jsoncons allows you to work with the data in a number of ways:
75
75
76
76
- As a variant-like data structure, [basic_json](https://github.com/danielaparker/jsoncons/blob/master/doc/ref/corelib/basic_json.md)
77
77
78
-
- As a strongly typed C++ data structure that implements [json_type_traits](https://github.com/danielaparker/jsoncons/blob/master/doc/ref/corelib/json_type_traits/json_type_traits.md)
78
+
- As a strongly typed C++ data structure that implements [json_type_traits](https://github.com/danielaparker/jsoncons/blob/master/doc/ref/corelib/legacy_reflect/json_type_traits.md)
79
79
80
80
- As a stream of parse events
81
81
@@ -145,7 +145,7 @@ jsoncons supports transforming JSON texts into C++ data structures.
145
145
The functions [decode_json](https://github.com/danielaparker/jsoncons/blob/master/doc/ref/corelib/decode_json.md) and [encode_json](https://github.com/danielaparker/jsoncons/blob/master/doc/ref/corelib/encode_json.md)
146
146
convert strings or streams of JSON data to C++ data structures and back.
147
147
Decode and encode work for all C++ classes that have
Copy file name to clipboardExpand all lines: doc/ref/corelib/reflection-traits.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,7 @@ Until 1.9.0, these were named [json_conv_traits](./reflect/json_conv_traits.md),
21
21
1.9.0, they have been renamed to [json_traits](./reflect/json_traits.md).
22
22
For backwards compatibility, the old name is aliased to the new name.
23
23
24
-
`json_traits` defaults to the legacy [json_type_traits](json_type_traits/json_type_traits.md) if a type conversion is undefined,
24
+
`json_traits` defaults to the legacy [json_type_traits](./legacy_reflect/json_type_traits.md) if a type conversion is undefined,
25
25
these traits do not support non-throwing conversions and uses-allocator construction.
26
26
27
27
See [Eigen::Matrix example](reflect/Eigen-Matrix-example.md) for an example of specializing `json_traits` for an [Eigen matrix class](https://eigen.tuxfamily.org/dox-devel/group__TutorialMatrixClass.html).
@@ -30,10 +30,10 @@ See [User-allocator construction example](reflect/uses-allocator-construction-ex
30
30
31
31
#### Legacy jsoncons::json_type_traits
32
32
33
-
[json_type_traits](json_type_traits/json_type_traits.md) defines a compile time template based interface for conversion between a `basic_json` value
33
+
[json_type_traits](./legacy_reflect/json_type_traits.md) defines a compile time template based interface for conversion between a `basic_json` value
34
34
and a value of some other type.
35
35
36
-
See [Eigen::Matrix example](json_type_traits/Eigen-Matrix-example.md) for an example of specializing `json_type_traits` for an [Eigen matrix class](https://eigen.tuxfamily.org/dox-devel/group__TutorialMatrixClass.html).
36
+
See [Eigen::Matrix example](./legacy_reflect/Eigen-Matrix-example.md) for an example of specializing `json_type_traits` for an [Eigen matrix class](https://eigen.tuxfamily.org/dox-devel/group__TutorialMatrixClass.html).
37
37
38
38
### Streaming traits
39
39
@@ -57,6 +57,6 @@ In the case that the jsoncons decode and encode traits have no specialization fo
57
57
### Convenience macros
58
58
59
59
jsoncons includes some [convenience macros](reflect/reflect-traits-gen.md) for generating reflection traits classes.
60
-
Until 1.4.0, these macros generated [json_type_traits](json_type_traits/json_type_traits.md) class templates. Since 1.4.0, they
60
+
Until 1.4.0, these macros generated [json_type_traits](./legacy_reflect/json_type_traits.md) class templates. Since 1.4.0, they
61
61
generate [json_traits](reflect/json_traits.md) class templates, as well as some additional traits that support streaming.
0 commit comments