Repository navigation
Add opt-in <rfl/nlohmann.hpp> adapter for nlohmann::json - #69
Open
clockblocker wants to merge 3 commits into
Open
clockblocker wants to merge 3 commits into
clockblocker wants to merge 3 commits into
Conversation
- N1: Add vcpkg nlohmann feature, conan with_nlohmann option, and wire REFLECTCPP_NLOHMANN into REFLECTCPP_ALL_FORMATS and vcpkg features. - N2: Enforce nlohmann_json >= 3.11.3 in CMake, package config, and Reader.hpp static_assert. - N3: Add is_nlohmann_reader_v/is_nlohmann_writer_v and lossless cross-BasicJson conversion; guard uint64_t and YAML quoted strings (Tag() == "!") in read_from_generic_reader. - N4: Support rfl::Vectorstring and nlohmann binary_t <-> Bytestring/Base64. - N5: Extract opt-in nlohmann/adl_serializer.hpp guarded by __cpp_exceptions, drop 2-arg from_json for Validator/const-field support, and throw BasicJsonType::other_error::create(501, ...). - N6-N8: Rename detail -> internal, use emplace + reserve in Writer, use BasicJson::string_t in Reader::find, add docs and expanded tests.
clockblocker
added a commit
that referenced
this pull request
Nov 29, 2026
…lohmann.hpp>) - Rebase #69 cleanly onto origin/main (290bdb2). - Deduplicate reserve_array, reserve_object, and emplace_field into rfl::nlohmann::internal in Writer.hpp and use insert_or_assign in Writer::emplace_in_object (eliminating default-null + overwrite). - Fix Reader integer range checks to use width-agnostic IntT/UIntT common-type bounds checks instead of hardcoded int64_t/uint64_t casts, and add a 32-bit custom basic_json bounds test. - Drop unnecessary (void) casts in Parser.hpp and document the msgpack-c v6 ABI layout constant (0x02). - Keep REFLECTCPP_NLOHMANN opt-in (OFF by default) with zero optional dependency leaks in CMake, reflectcpp-config.cmake.in, vcpkg, or Conan.
clockblocker
added a commit
that referenced
this pull request
Nov 29, 2026
…lohmann.hpp>) - Rebase #69 cleanly onto origin/main (290bdb2). - Deduplicate reserve_array, reserve_object, and emplace_field into rfl::nlohmann::internal in Writer.hpp and use insert_or_assign in Writer::emplace_in_object (eliminating default-null + overwrite). - Fix Reader integer range checks to use width-agnostic IntT/UIntT common-type bounds checks instead of hardcoded int64_t/uint64_t casts, and add a 32-bit custom basic_json bounds test. - Drop unnecessary (void) casts in Parser.hpp and document the msgpack-c v6 ABI layout constant (0x02). - Keep REFLECTCPP_NLOHMANN opt-in (OFF by default) with zero optional dependency leaks in CMake, reflectcpp-config.cmake.in, vcpkg, or Conan.
clockblocker
added a commit
that referenced
this pull request
Nov 29, 2026
…lohmann.hpp>) - Rebase #69 cleanly onto origin/main (290bdb2). - Deduplicate reserve_array, reserve_object, and emplace_field into rfl::nlohmann::internal in Writer.hpp and use insert_or_assign in Writer::emplace_in_object (eliminating default-null + overwrite). - Fix Reader integer range checks to use width-agnostic IntT/UIntT common-type bounds checks instead of hardcoded int64_t/uint64_t casts, and add a 32-bit custom basic_json bounds test. - Drop unnecessary (void) casts in Parser.hpp and document the msgpack-c v6 ABI layout constant (0x02). - Keep REFLECTCPP_NLOHMANN opt-in (OFF by default) with zero optional dependency leaks in CMake, reflectcpp-config.cmake.in, vcpkg, or Conan.
clockblocker
added a commit
that referenced
this pull request
Nov 29, 2026
…lohmann.hpp>) - Rebase #69 cleanly onto origin/main (290bdb2). - Deduplicate reserve_array, reserve_object, and emplace_field into rfl::nlohmann::internal in Writer.hpp and use insert_or_assign in Writer::emplace_in_object (eliminating default-null + overwrite). - Fix Reader integer range checks to use width-agnostic IntT/UIntT common-type bounds checks instead of hardcoded int64_t/uint64_t casts, and add a 32-bit custom basic_json bounds test. - Drop unnecessary (void) casts in Parser.hpp and document the msgpack-c v6 ABI layout constant (0x02). - Keep REFLECTCPP_NLOHMANN opt-in (OFF by default) with zero optional dependency leaks in CMake, reflectcpp-config.cmake.in, vcpkg, or Conan.
clockblocker
added a commit
that referenced
this pull request
Nov 29, 2026
…lohmann.hpp>) - Rebase #69 cleanly onto origin/main (290bdb2). - Deduplicate reserve_array, reserve_object, and emplace_field into rfl::nlohmann::internal in Writer.hpp and use insert_or_assign in Writer::emplace_in_object (eliminating default-null + overwrite). - Fix Reader integer range checks to use width-agnostic IntT/UIntT common-type bounds checks instead of hardcoded int64_t/uint64_t casts, and add a 32-bit custom basic_json bounds test. - Drop unnecessary (void) casts in Parser.hpp and document the msgpack-c v6 ABI layout constant (0x02). - Keep REFLECTCPP_NLOHMANN opt-in (OFF by default) with zero optional dependency leaks in CMake, reflectcpp-config.cmake.in, vcpkg, or Conan.
clockblocker
added a commit
that referenced
this pull request
Nov 30, 2026
…lohmann.hpp>) - Rebase #69 cleanly onto origin/main (290bdb2). - Deduplicate reserve_array, reserve_object, and emplace_field into rfl::nlohmann::internal in Writer.hpp and use insert_or_assign in Writer::emplace_in_object (eliminating default-null + overwrite). - Fix Reader integer range checks to use width-agnostic IntT/UIntT common-type bounds checks instead of hardcoded int64_t/uint64_t casts, and add a 32-bit custom basic_json bounds test. - Drop unnecessary (void) casts in Parser.hpp and document the msgpack-c v6 ABI layout constant (0x02). - Keep REFLECTCPP_NLOHMANN opt-in (OFF by default) with zero optional dependency leaks in CMake, reflectcpp-config.cmake.in, vcpkg, or Conan.
clockblocker
added a commit
that referenced
this pull request
Nov 30, 2026
…lohmann.hpp>) - Rebase #69 cleanly onto origin/main (290bdb2). - Deduplicate reserve_array, reserve_object, and emplace_field into rfl::nlohmann::internal in Writer.hpp and use insert_or_assign in Writer::emplace_in_object (eliminating default-null + overwrite). - Fix Reader integer range checks to use width-agnostic IntT/UIntT common-type bounds checks instead of hardcoded int64_t/uint64_t casts, and add a 32-bit custom basic_json bounds test. - Drop unnecessary (void) casts in Parser.hpp and document the msgpack-c v6 ABI layout constant (0x02). - Keep REFLECTCPP_NLOHMANN opt-in (OFF by default) with zero optional dependency leaks in CMake, reflectcpp-config.cmake.in, vcpkg, or Conan.
clockblocker
added a commit
that referenced
this pull request
Nov 30, 2026
…lohmann.hpp>) - Rebase #69 cleanly onto origin/main (290bdb2). - Deduplicate reserve_array, reserve_object, and emplace_field into rfl::nlohmann::internal in Writer.hpp and use insert_or_assign in Writer::emplace_in_object (eliminating default-null + overwrite). - Fix Reader integer range checks to use width-agnostic IntT/UIntT common-type bounds checks instead of hardcoded int64_t/uint64_t casts, and add a 32-bit custom basic_json bounds test. - Drop unnecessary (void) casts in Parser.hpp and document the msgpack-c v6 ABI layout constant (0x02). - Keep REFLECTCPP_NLOHMANN opt-in (OFF by default) with zero optional dependency leaks in CMake, reflectcpp-config.cmake.in, vcpkg, or Conan.
clockblocker
added a commit
that referenced
this pull request
Dec 1, 2026
…lohmann.hpp>) - Rebase #69 cleanly onto origin/main (290bdb2). - Deduplicate reserve_array, reserve_object, and emplace_field into rfl::nlohmann::internal in Writer.hpp and use insert_or_assign in Writer::emplace_in_object (eliminating default-null + overwrite). - Fix Reader integer range checks to use width-agnostic IntT/UIntT common-type bounds checks instead of hardcoded int64_t/uint64_t casts, and add a 32-bit custom basic_json bounds test. - Drop unnecessary (void) casts in Parser.hpp and document the msgpack-c v6 ABI layout constant (0x02). - Keep REFLECTCPP_NLOHMANN opt-in (OFF by default) with zero optional dependency leaks in CMake, reflectcpp-config.cmake.in, vcpkg, or Conan.
clockblocker
added a commit
that referenced
this pull request
Dec 1, 2026
…lohmann.hpp>) - Rebase #69 cleanly onto origin/main (290bdb2). - Deduplicate reserve_array, reserve_object, and emplace_field into rfl::nlohmann::internal in Writer.hpp and use insert_or_assign in Writer::emplace_in_object (eliminating default-null + overwrite). - Fix Reader integer range checks to use width-agnostic IntT/UIntT common-type bounds checks instead of hardcoded int64_t/uint64_t casts, and add a 32-bit custom basic_json bounds test. - Drop unnecessary (void) casts in Parser.hpp and document the msgpack-c v6 ABI layout constant (0x02). - Keep REFLECTCPP_NLOHMANN opt-in (OFF by default) with zero optional dependency leaks in CMake, reflectcpp-config.cmake.in, vcpkg, or Conan.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an opt-in, header-only
nlohmann::jsonbackend and interop adapter (<rfl/nlohmann.hpp>), enabling directrfl::nlohmann::read/write, losslessnlohmann::basic_jsonfields inside reflected structs across formats, and opt-innlohmann::adl_serializerintegration.Example
Key details
REFLECTCPP_NLOHMANN(wired intoREFLECTCPP_ALL_FORMATS,vcpkg.json, andconanfile.py; requiresnlohmann_json >= 3.11.3).nlohmann::basic_jsonspecializations,rfl::Vectorstring, andnlohmann::binary_t↔Bytestring/Base64, with guardeduint64_tand YAML quoted-string handling across formats.<rfl/nlohmann/adl_serializer.hpp>(guarded by__cpp_exceptions) usesfrom_jsonreturningTdirectly sorfl::Validatorandconstfields work cleanly.docs/content/supported_formats/nlohmann.md.AI-authored.