Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
json
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
json
Commits
59cb7674
Unverified
Commit
59cb7674
authored
Jul 23, 2020
by
Niels Lohmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
📝
update documentation
parent
0cd120f7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
0 deletions
+24
-0
arbitrary_types.md
doc/mkdocs/docs/features/arbitrary_types.md
+4
-0
macros.md
doc/mkdocs/docs/features/macros.md
+20
-0
No files found.
doc/mkdocs/docs/features/arbitrary_types.md
View file @
59cb7674
...
...
@@ -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.
!!! note
At most 64 member variables can be passed to `NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE` or `NLOHMANN_DEFINE_TYPE_INTRUSIVE`.
??? example
The `to_json`/`from_json` functions for the `person` struct above can be created with:
...
...
doc/mkdocs/docs/features/macros.md
View file @
59cb7674
...
...
@@ -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.
## `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...)`
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.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment