mirror of
https://github.com/nlohmann/json.git
synced 2026-07-09 03:55:09 +00:00
deploy: 7c9208bfb3
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
# <small>nlohmann::basic_json::</small>json_serializer
|
||||
|
||||
```cpp
|
||||
template<typename T, typename SFINAE>
|
||||
using json_serializer = JSONSerializer<T, SFINAE>;
|
||||
```
|
||||
|
||||
## Template parameters
|
||||
|
||||
`T`
|
||||
: type to convert; will be used in the `to_json`/`from_json` functions
|
||||
|
||||
`SFINAE`
|
||||
: type to add compile type checks via SFINAE; usually `#!cpp void`
|
||||
|
||||
## Notes
|
||||
|
||||
#### Default type
|
||||
|
||||
The default values for `json_serializer` is [`adl_serializer`](../adl_serializer/index.md).
|
||||
|
||||
## Examples
|
||||
|
||||
??? example
|
||||
|
||||
The example below shows how a conversion of a non-default-constructible type is implemented via a specialization of
|
||||
the `adl_serializer`.
|
||||
|
||||
```cpp
|
||||
--8<-- "examples/from_json__non_default_constructible.cpp"
|
||||
```
|
||||
|
||||
Output:
|
||||
|
||||
```json
|
||||
--8<-- "examples/from_json__non_default_constructible.output"
|
||||
```
|
||||
|
||||
## Version history
|
||||
|
||||
- Since version 2.0.0.
|
||||
Reference in New Issue
Block a user