Repository navigation
Conversation
nlohmann
added this pull request to stack #5636
September 29, 2026 14:20
Owner
Author
|
CI fixes for this PR (commits 87a041a and ab4f646):
Verified with the CI's own image — posted by Claude Code on behalf of @nlohmann |
This was referenced Sep 29, 2026
nlohmann
removed this pull request from stack #5636
September 30, 2026 13:19
nlohmann
force-pushed
the
json-view/08-view-builder
branch
from
September 30, 2026 13:20
ab4f646 to
dc9899f
Compare
nlohmann
added this pull request to stack #5739
September 30, 2026 13:21
nlohmann
force-pushed
the
json-view/08-view-builder
branch
3 times, most recently
from
September 30, 2026 18:06
7030188 to
c195988
Compare
nlohmann
marked this pull request as ready for review
September 30, 2026 18:18
nlohmann
force-pushed
the
json-view/08-view-builder
branch
from
September 30, 2026 18:19
c195988 to
e96e298
Compare
nlohmann
removed this pull request from stack #5739
October 6, 2026 09:26
nlohmann
force-pushed
the
json-view/08-view-builder
branch
from
October 6, 2026 09:28
2739c0b to
4303ba6
Compare
nlohmann
changed the base branch from
json-view/04-unicode-escapes
to
json-view/23-zmij
October 6, 2026 09:29
nlohmann
added this pull request to stack #5768
October 6, 2026 09:29
nlohmann
force-pushed
the
json-view/08-view-builder
branch
from
October 7, 2026 14:44
4303ba6 to
759dd2e
Compare
🔴 Amalgamation check failed! 🔴The source code has not been amalgamated and/or formatted correctly, or 📎 A ready-to-apply patch is attached to the failed workflow run as the git apply amalgamation.patchThis does not require installing astyle yourself. |
nlohmann
added a commit
that referenced
this pull request
Oct 17, 2026
The review of #5620 renamed document_data's tape/tape_size/tape_cap to nodes/node_count/node_capacity and made the decode arena a std::vector<char>; adapt the code of this change to it. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
Qt defines emit as an empty macro, so a Qt header included before json_view.hpp broke the declaration of the builder's emit(), see issue #5865. It is now called push_node(). Signed-off-by: Niels Lohmann <mail@nlohmann.me>
nlohmann
added a commit
that referenced
this pull request
Oct 17, 2026
The review of #5620 renamed document_data's tape/tape_size/tape_cap to nodes/node_count/node_capacity and made the decode arena a std::vector<char>; adapt the code of this change to it. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
nlohmann
added a commit
that referenced
this pull request
Oct 17, 2026
The review of #5620 renamed document_data's tape/tape_size/tape_cap to nodes/node_count/node_capacity and made the decode arena a std::vector<char>; adapt the code of this change to it. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
nlohmann
added a commit
that referenced
this pull request
Oct 17, 2026
The review of #5620 renamed document_data's tape/tape_size/tape_cap to nodes/node_count/node_capacity and made the decode arena a std::vector<char>; adapt the code of this change to it. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
nlohmann
added a commit
that referenced
this pull request
Oct 17, 2026
The review of #5620 renamed document_data's tape/tape_size/tape_cap to nodes/node_count/node_capacity and made the decode arena a std::vector<char>; adapt the code of this change to it. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
| return n; | ||
| } | ||
|
|
||
| NLOHMANN_VIEW_ALWAYS_INLINE void open(value_t k) |
| { | ||
| if (d.node_count != 0) | ||
| { | ||
| std::memcpy(fresh, d.nodes, d.node_count * sizeof(node)); |
gregmarr
approved these changes
Oct 17, 2026
memcpy() must not be passed a null pointer even for zero bytes, which arena_run() did for an empty run while the arena was still empty (ci_test_clang_sanitizer: "null pointer passed as argument 1" in builder.hpp). Only the slow path can see such a run. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
nlohmann
added a commit
that referenced
this pull request
Oct 17, 2026
The review of #5620 renamed document_data's tape/tape_size/tape_cap to nodes/node_count/node_capacity and made the decode arena a std::vector<char>; adapt the code of this change to it. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
nlohmann
added a commit
that referenced
this pull request
Oct 17, 2026
The review of #5620 renamed document_data's tape/tape_size/tape_cap to nodes/node_count/node_capacity and made the decode arena a std::vector<char>; adapt the code of this change to it. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
nlohmann
added a commit
that referenced
this pull request
Oct 17, 2026
The review of #5620 renamed document_data's tape/tape_size/tape_cap to nodes/node_count/node_capacity and made the decode arena a std::vector<char>; adapt the code of this change to it. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
nlohmann
added a commit
that referenced
this pull request
Oct 17, 2026
The review of #5620 renamed document_data's tape/tape_size/tape_cap to nodes/node_count/node_capacity and made the decode arena a std::vector<char>; adapt the code of this change to it. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
| if (n <= 16 && m_end - r >= 16) | ||
| { | ||
| arena_ensure(16); | ||
| std::memcpy(m_arena_write, r, 16); |
nlohmann
added a commit
that referenced
this pull request
Oct 18, 2026
The review of #5620 renamed document_data's tape/tape_size/tape_cap to nodes/node_count/node_capacity and made the decode arena a std::vector<char>; adapt the code of this change to it. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
nlohmann
added a commit
that referenced
this pull request
Oct 18, 2026
The review of #5620 renamed document_data's tape/tape_size/tape_cap to nodes/node_count/node_capacity and made the decode arena a std::vector<char>; adapt the code of this change to it. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
nlohmann
added a commit
that referenced
this pull request
Oct 18, 2026
The review of #5620 renamed document_data's tape/tape_size/tape_cap to nodes/node_count/node_capacity and made the decode arena a std::vector<char>; adapt the code of this change to it. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
Infer's std::unique_ptr model confuses the values that the test's build() helper returns by value and reports USE_AFTER_DELETE for one of them after the destructor of an unrelated temporary (ci_infer, 12 reports, all in tests/src/unit-json_view_builder.cpp). AddressSanitizer is clean on the same tests. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
nlohmann
added a commit
that referenced
this pull request
Oct 18, 2026
The review of #5620 renamed document_data's tape/tape_size/tape_cap to nodes/node_count/node_capacity and made the decode arena a std::vector<char>; adapt the code of this change to it. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
nlohmann
added a commit
that referenced
this pull request
Oct 18, 2026
The review of #5620 renamed document_data's tape/tape_size/tape_cap to nodes/node_count/node_capacity and made the decode arena a std::vector<char>; adapt the code of this change to it. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
nlohmann
added a commit
that referenced
this pull request
Oct 18, 2026
The review of #5620 renamed document_data's tape/tape_size/tape_cap to nodes/node_count/node_capacity and made the decode arena a std::vector<char>; adapt the code of this change to it. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
nlohmann
added a commit
that referenced
this pull request
Oct 18, 2026
The review of #5620 renamed document_data's tape/tape_size/tape_cap to nodes/node_count/node_capacity and made the decode arena a std::vector<char>; adapt the code of this change to it. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
nlohmann
added a commit
that referenced
this pull request
Oct 18, 2026
The review of #5620 renamed document_data's tape/tape_size/tape_cap to nodes/node_count/node_capacity and made the decode arena a std::vector<char>; adapt the code of this change to it. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
nlohmann
added a commit
that referenced
this pull request
Oct 18, 2026
The review of #5620 renamed document_data's tape/tape_size/tape_cap to nodes/node_count/node_capacity and made the decode arena a std::vector<char>; adapt the code of this change to it. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
nlohmann
added a commit
that referenced
this pull request
Oct 18, 2026
The review of #5620 renamed document_data's tape/tape_size/tape_cap to nodes/node_count/node_capacity and made the decode arena a std::vector<char>; adapt the code of this change to it. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
nlohmann
added a commit
that referenced
this pull request
Oct 18, 2026
The review of #5620 renamed document_data's tape/tape_size/tape_cap to nodes/node_count/node_capacity and made the decode arena a std::vector<char>; adapt the code of this change to it. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
nlohmann
added a commit
that referenced
this pull request
Oct 18, 2026
The review of #5620 renamed document_data's tape/tape_size/tape_cap to nodes/node_count/node_capacity and made the decode arena a std::vector<char>; adapt the code of this change to it. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
nlohmann
added a commit
that referenced
this pull request
Oct 18, 2026
The review of #5620 renamed document_data's tape/tape_size/tape_cap to nodes/node_count/node_capacity and made the decode arena a std::vector<char>; adapt the code of this change to it. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
4 tasks
This branch has not been deployed
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.
Part of the stack for the zero-copy view (#5295). This adds the internal node index and parser, and the public
json_document/json_viewclasses built on it. Element access, values,dump(), and comparisons follow in later PRs, so each one stays reviewable.Summary
max_nodes()when the index grows; beyond it,std::bad_allocis thrown.json::parseaccepts: every combination ofignore_commentsandignore_trailing_commas, with and without a trailing NUL, and underJSON_STRICT_NUL_HANDLING. It is portable C++11, and nothing depends on the byte order: words are read in a fixed order, node fields are written explicitly, and literals are compared withmemcmp. The SIMD kernels come later in the stack.basic_json_document<BasicJsonType>:parse,parse_copy,accept,read(reuses the document's memory),root,is_discarded,source,owns_source,node_count,memory_usage,shrink_to_fit.basic_json_view<BasicJsonType>:type, theis_*queries,size,empty,materialize,source_offset.json_document,json_view,ordered_json_document,ordered_json_view.std::string_view, C strings, character arrays, pointer ranges, and in C++20 other contiguous iterator ranges) or owned (a non-const rvaluestd::string, moved in; a const rvaluestd::stringand other rvalue byte containers, copied; streams and wide strings, read into a buffer). AFILE*and pointers to or arrays of wide characters are rejected at compile time.parse,parse_copy,accept, andreadwith an integer as the second argument are deleted:parse(ptr, len)would silently convertlentoallow_exceptionsand readptrwithstrlen. Useparse(ptr, ptr + len).basic_json::parsewould throw for the same input. The library parser runs on the failing input (a cold path), so message, position, and id match.out_of_range.416("input of 4294967280 bytes or more is not supported by json_document").materialize(): builds the value with the SAX handlerparse()uses, soJSON_DIAGNOSTICSparent pointers are set as usual.root()of a temporary document is deleted: the view would dangle. Give the document a name first.detail::abi_configkeepsJSON_STRICT_NUL_HANDLINGreadable afterjson.hppundefines it at its end, in the ABI namespace, which already encodes the setting, so it always matches thebasic_jsonin use.out_of_range.416inexceptions.md, the C++20 module exports, an amalgamatedsingle_include/nlohmann/json_view.hpp(make amalgamate,check_amalgamation), a fuzzer, the benchmarks, Bazel, and theaspect: json_viewlabel inlabeler.yml.Performance
Measured on Apple M1 Max (Apple clang,
-O2) and an x86-64 KVM Haswell VPS pinned to one core (GCC 13 / Clang 18,-O2; the VPS is noisy, about ±5-10%). µs, best of 3 interleaved rounds of 15 runs; files from nativejson-benchmark.json_document::parsevsjson::parse(both at this PR):The core library is unaffected: this PR only adds code under
include/nlohmann/detail/view/and the new public headerjson_view.hpp.json.hpponly gains the internaldetail::abi_configconstant and one include.Tests
unit-json_view_builder.cpp: the node index compared withjson::parsefor handwritten, generated, and damaged documents under all option combinations; input fromstd::stringand from exact-size buffers with no read past the input under AddressSanitizer; deep nesting up to 100,000 levels; NUL, BOM, and whitespace cases; node integer bits and the array size limit; and the test-suite files.unit-json_view.cpp:materialize()equalsparse()for handwritten and generated documents, with duplicate keys, deep nesting, andJSON_DIAGNOSTICSparents; parse errors equalparse()'s, message included, for malformed inputs under all option combinations; every input kind, borrowed or owned; integer arguments androot()of a temporary document do not compile; the input size limit; reuse withread(), moves,shrink_to_fit(), and source offsets.unit-json_view_macros.cpp: includes the header withoutJSON_TEST_KEEP_MACROS, as users do, and checks that the view relies on no macrojson.hppundefines and leaks none of its ownNLOHMANN_VIEW_*macros.fuzzer-parse_json_view.cpp): accept, value, and exception parity withjson::parse, for astd::stringand an exact-size byte vector, with and without comments and trailing commas.Public API
No breaking changes. Everything is new and additive; nothing existing changes. The view API is new in this stack, so the following decisions are not breaking relative to a release, but they are visible to users:
<nlohmann/json_view.hpp>withbasic_json_document,basic_json_view, and the aliasesjson_document,json_view,ordered_json_document,ordered_json_view.json_viewhas nooperator bool: write!v.is_discarded().root()of an rvalue document is deleted (it would dangle); use a named document.parse,parse_copy,accept, andreadwith an integer second argument do not compile (deleted overloads).std::stringis copied, not moved.out_of_range.416(input of 4294967280 bytes or more).basic_json_document<BasicJsonType>requires 64-bit integer types (static_assert).json.hppgains the internaldetail::abi_configconstant (not part of the public API).Written by Claude Code.
🤖 Generated with Claude Code