Files
json/docs/mkdocs/docs/api/macros/nlohmann_json_namespace.md
T
Niels Lohmann 4da932f518 Make parsing from std::istream and FILE* fast (#5828)
* Make parsing from std::istream and FILE* fast

Squashed onto develop cd6b428ef (CI fixes from #5860). Original commits:

- Let the lexer's bulk fast paths run on a window of the input
- Scan the get area of an input stream in bulk
- Lock a FILE once per parse instead of once per character
- Add benchmarks for parsing from a FILE* and for many values from a stream
- Avoid implicit unsigned char to char conversion in stream tests
- Make file_input_adapter::unlock() safe to call on a moved-from adapter

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

* Add ABI tags for JSON_DISABLE_STREAM_BULK_SCAN and JSON_DISABLE_UNLOCKED_FILE_IO

Both macros select between two definitions of an input adapter, so
translation units compiled with different settings violated the ODR when
linked together. Like the other ABI-affecting macros, they now append a
tag to the inline namespace: _dsbs and _dufio. Their defaults move to
abi_macros.hpp so that json_fwd.hpp sees them, and the natvis file is
regenerated for the new namespaces.

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

* Skip the exception-only checks of the stream input tests without exceptions

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

---------

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
2026-10-19 22:00:58 +02:00

1.3 KiB

NLOHMANN_JSON_NAMESPACE

#define NLOHMANN_JSON_NAMESPACE /* value */

This macro evaluates to the full name of the nlohmann namespace.

Default definition

The default value consists of the root namespace (nlohmann) and an inline ABI namespace. See nlohmann Namespace for details.

When the macro is not defined, the library will define it to its default value. Overriding this value has no effect on the library.

Examples

??? example

The example shows how to use `NLOHMANN_JSON_NAMESPACE` instead of just `nlohmann`, as well as how to output the value
of `NLOHMANN_JSON_NAMESPACE`.

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

Output:

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

See also

Version history

  • Added in version 3.11.0. Changed inline namespace name in version 3.11.2. Added the ABI tag _dp in version 3.12.0, and the ABI tags _bics, _psp, _snul, _sbu8, _ekmo, _dsbs, and _dufio in version 3.13.0; see nlohmann Namespace.