mirror of
https://github.com/nlohmann/json.git
synced 2026-10-03 13:10:33 +00:00
1.3 KiB
1.3 KiB
nlohmann::basic_json::parse_event_t
enum class parse_event_t : std::uint8_t {
object_start,
object_end,
array_start,
array_end,
key,
value
};
The parser callback distinguishes the following events:
object_start: the parser read{and started to process a JSON objectkey: the parser read a key of a value in an objectobject_end: the parser read}and finished processing a JSON objectarray_start: the parser read[and started to process a JSON arrayarray_end: the parser read]and finished processing a JSON arrayvalue: the parser finished reading a JSON value
Examples
??? example
The following code parses a small JSON text with a parser callback that reports every event together with its
depth and keeps every value (by always returning `#!cpp true`).
```cpp
--8<-- "examples/parse_event_t.cpp"
```
Output:
```json
--8<-- "examples/parse_event_t.output"
```
See also
- parser_callback_t callback function type for the parser
- parse deserialize from a compatible input
Version history
- Added in version 1.0.0.
