Files
json/tools/generate_natvis
Niels LohmannandMihnea Magheru e752688b52 Add a natvis fallback visualizer for detail::json_default_base (#5588)
* Add a natvis fallback visualizer for detail::json_default_base

Squashed onto develop from:
- Add a type in the natvis template for detail::json_default_base
- Document the json_default_base natvis fallback and regenerate natvis
- Match json_default_base in both its current and 3.12.0 namespace

Co-authored-by: Mihnea Magheru <sakuntalle@yahoo.com>
Signed-off-by: Mihnea Magheru <sakuntalle@yahoo.com>
Signed-off-by: Niels Lohmann <mail@nlohmann.me>

* Take the natvis template from the PR in the amalgamation check

The check ran generate_natvis.py from a develop checkout, which loads
nlohmann_json.natvis.j2 from its own directory. A PR that changes the
template was therefore checked against develop's template and always
failed. Copy the PR's template next to the develop script before
running it.

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

---------

Signed-off-by: Mihnea Magheru <sakuntalle@yahoo.com>
Signed-off-by: Niels Lohmann <mail@nlohmann.me>
Co-authored-by: Mihnea Magheru <sakuntalle@yahoo.com>
2026-10-07 19:17:41 +02:00
..

generate_natvis.py

Generate the Natvis debugger visualization file for all supported namespace combinations.

The ABI tag list and the library version are parsed from include/nlohmann/detail/abi_macros.hpp, so this script must be re-run (via make natvis) whenever an NLOHMANN_JSON_ABI_TAG_* macro is added to that file or the library version is bumped — otherwise the committed nlohmann_json.natvis drifts from the header it visualizes, and make check-amalgamation fails.

Usage

make natvis

or, equivalently:

./generate_natvis.py [--version X.Y.Z] [repository_root/]

--version and the output/repository-root directory both default to values derived from this script's own location, so they only need to be given explicitly when generating a Natvis file for a different checkout or a version other than the one in abi_macros.hpp.