Files
json/api/basic_json/input_format_t.md
T
2026-10-03 05:43:12 +00:00

1.1 KiB

nlohmann::basic_json::input_format_t

enum class input_format_t {
    json,
    cbor,
    msgpack,
    ubjson,
    bson,
    bjdata,
    bon8
};

This enumeration is used in the sax_parse function to choose the input format to parse:

json
JSON (JavaScript Object Notation)
cbor
CBOR (Concise Binary Object Representation)
msgpack
MessagePack
ubjson
UBJSON (Universal Binary JSON)
bson
BSON (Binary JSON)
bjdata
BJData (Binary JData)
bon8
BON8 (Binary Object Notation 8)

Examples

??? example

The example below shows how an `input_format_t` enum value is passed to `sax_parse` to set the input format to CBOR.

```cpp
--8<-- "examples/sax_parse__binary.cpp"
```

Output:

```json
--8<-- "examples/sax_parse__binary.output"
```

See also

  • sax_parse generic SAX parse interface, taking an input_format_t to select the input format
  • cbor_tag_handler_t configures how CBOR tags are treated while parsing

Version history

  • Added in version 3.2.0.