📝 update documentation

parent 0cd120f7
...@@ -92,6 +92,10 @@ There are two macros to make your life easier as long as you (1) want to use a J ...@@ -92,6 +92,10 @@ There are two macros to make your life easier as long as you (1) want to use a J
In both macros, the first parameter is the name of the class/struct, and all remaining parameters name the members. In both macros, the first parameter is the name of the class/struct, and all remaining parameters name the members.
!!! note
At most 64 member variables can be passed to `NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE` or `NLOHMANN_DEFINE_TYPE_INTRUSIVE`.
??? example ??? example
The `to_json`/`from_json` functions for the `person` struct above can be created with: The `to_json`/`from_json` functions for the `person` struct above can be created with:
......
...@@ -32,6 +32,26 @@ This macro overrides `#!cpp try` calls inside the library. It has no arguments a ...@@ -32,6 +32,26 @@ This macro overrides `#!cpp try` calls inside the library. It has no arguments a
See [Switch off exceptions](../home/exceptions.md#switch-off-exceptions) for an example. See [Switch off exceptions](../home/exceptions.md#switch-off-exceptions) for an example.
## `JSON_USE_IMPLICIT_CONVERSIONS`
When defined to `0`, implicit conversions are switched off. By default, implicit conversions are switched on.
??? example
This is an example for an implicit conversion:
```cpp
json j = "Hello, world!";
std::string s = j;
```
When `JSON_USE_IMPLICIT_CONVERSIONS` is defined to `0`, the code above does no longer compile. Instead, it must be written like this:
```cpp
json j = "Hello, world!";
auto s = j.get<std::string>();
```
## `NLOHMANN_DEFINE_TYPE_INTRUSIVE(type, member...)` ## `NLOHMANN_DEFINE_TYPE_INTRUSIVE(type, member...)`
This macro can be used to simplify the serialization/deserialization of types if (1) want to use a JSON object as serialization and (2) want to use the member variable names as object keys in that object. This macro can be used to simplify the serialization/deserialization of types if (1) want to use a JSON object as serialization and (2) want to use the member variable names as object keys in that object.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment