Niels Lohmann and Claude Sonnet 5
55ff4c9eff
test: drop a trailing NUL byte from the nativejson-benchmark 1e308 fixture
...
The "doubles" compliance test built its 1e308 literal as a std::string
sized to 312 bytes with an explicit trailing '\0' at index 311, relying
on the old NUL-as-EOF lexer behavior removed earlier in this branch: with
that removed, the NUL is ordinary (invalid) trailing data instead of
being silently swallowed, so json::parse() correctly rejected it with
parse_error.101 - breaking CI across every compiler/platform, since this
one nativejson-benchmark TEST_CASE is exercised by every test job.
No padding is needed at all: json::parse(const std::string&) already
uses the string's own size(), not a NUL terminator. Drop the trailing
byte and shrink the string by one to match (index 310 - the new last
index - is where ']' now goes), fixing this the same way the other
pre-existing tests in this branch that depended on the same bug were
already fixed.
Signed-off-by: Niels Lohmann <niels.lohmann@gmail.com >
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com >
Claude-Session: https://claude.ai/code/session_01N4RQ1Ahan5YAGbnAQGjZTY
2026-09-15 10:22:47 +00:00
Niels Lohmann and Claude Sonnet 5
633eef8494
fix: treat a NUL byte in the input as an ordinary byte, not EOF
...
The lexer's token dispatch had `case '\0':` fall through to the same
`end_of_input` handling as the real end-of-file sentinel, with a comment
claiming the NUL case was "needed when parsing from string literals".
That rationale no longer holds: input_adapter(const char*) already uses
strlen() to compute its range, so it never hands the lexer a trailing
NUL, and the const-char* overload is the only "string literal" path the
comment could be referring to. In practice, `case '\0':` only ever fired
on a genuine embedded or trailing NUL byte in real input data (e.g. a
std::string with '\0' appended), which was then silently swallowed as if
it were EOF instead of producing the parse_error.101 any other
unexpected byte gets. Two more spots in the comment-skipping logic had
the same NUL-as-EOF idiom, stopping a `//` or `/* */` comment scan early
at an embedded NUL instead of continuing to the real terminator.
Removing all three still left one real regression: input_adapter's
T(&array)[N] overload (used for a string literal like
json::parse("123"), as opposed to a decayed const char* pointer) passes
the array's full extent through unchanged, trailing '\0' included. That
path was relying on the lexer's old NUL-as-EOF behavior to make ordinary
literal parsing work at all. It now gets its own strlen()-like handling
for char arrays specifically: a single trailing NUL terminator is
excluded, mirroring the pointer overload, while non-char arrays (e.g.
uint8_t buffers for binary formats) are left untouched since a trailing
zero byte there may be data.
Also updates a few existing tests that (mostly incidentally) depended on
a trailing NUL being swallowed - std::array<uint8_t, 5>{"true"} left the
5th element zero-initialized - and adds an FAQ entry.
Signed-off-by: Niels Lohmann <niels.lohmann@gmail.com >
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com >
Claude-Session: https://claude.ai/code/session_01N4RQ1Ahan5YAGbnAQGjZTY
2026-09-15 07:12:35 +00:00
Niels Lohmann
b772649624
Add maintainer targets to create source archive ( #3289 )
...
* 🔨 add script to create xz archive
2022-01-25 19:53:02 +01:00
Niels Lohmann
6cd68ebd12
📝 add documentation for JSON Lines (#3247 )
2022-01-05 09:51:29 +01:00
Niels Lohmann
a8e86ba948
📝 improve documentation InputType and IteratorType (#3246 )
2022-01-04 15:02:39 +01:00
Niels Lohmann
9e89c2fdb5
♻️ remove stringstream (#3244 )
2022-01-04 09:25:41 +01:00
Niels Lohmann
b69713c394
Fix compilation error with NVCC ( #3234 )
2022-01-02 09:03:56 +01:00
Niels Lohmann
926df56ddb
🔥 remove Travis CI #3087 ( #3233 )
2021-12-31 11:04:29 +01:00
Niels Lohmann
1aca6cb949
Add build step for NVCC and fix a warning ( #3227 )
...
* 👷 add step for NVCC build #2676
* 🚨 fix warning (code taken from #2736 )
* 👷 use version 2.2.0 of the CI image
2021-12-30 13:40:15 +01:00
Niels Lohmann
e6bf789f7d
⬆️ update cpplint (#3225 )
2021-12-29 20:20:15 +01:00
Niels Lohmann
29cd970b94
Consolidate documentation ( #3071 )
...
* 🔥 consolidate documentation
* ♻️ overwork std specializations
* 🚚 move images files to mkdocs
* ♻️ fix URLs
* 🔧 tweak MkDocs configuration
* 🔧 add namespaces
* 📝 document deprecations
* 📝 document documentation generation
* 🚸 improve search
* 🚸 add examples
* 🚧 start adding documentation for macros
* 📝 add note for https://github.com/nlohmann/json/issues/874#issuecomment-1001699139
* 📝 overwork example handling
* 📝 fix Markdown tables
2021-12-29 13:41:01 +01:00
Niels Lohmann
6d3115924c
Add C++17 copies of the test binaries ( #3101 )
...
* ⚗️ add C++17 copies of the test binaries
* ⚗️ use proper header for filesystem
* 🚨 fix warnings
* ⚗️ do not use too old compilers with C++17
* ✅ add test
* 🔨 add more constraints #3097
* ⚗️ use fix from https://github.com/nlohmann/json/pull/3101#issuecomment-998788786
* ⚗️ use fix from https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90050
* 👷 use published CI image
2021-12-29 09:47:05 +01:00
Niels Lohmann
e9f88c2fad
Add missing erase(first, last) function to ordered_map ( #3109 )
2021-11-09 22:24:58 +01:00
Niels Lohmann
5c08a52fd6
♻️ overwork std specializations (#3121 )
2021-11-04 16:38:40 +01:00
Niels Lohmann
5d87c4d409
Add recursive update function ( #3069 )
...
* ✨ add recursive update function
2021-11-03 13:52:20 +01:00
Niels Lohmann
7440786b81
Update CI ( #3088 )
...
* 👷 prepare GitHub actions for new Docker image
* 👷 use experimental docker image
* 👷 use Clang-Analyzer 14
* 🔇 suppress readability-identifier-length
* 🔇 suppress more Clang-Tidy warnings
* ♻️ simplify code
* 🔇 suppress more Clang-Tidy warnings
* 🔇 suppress more Clang-Tidy warnings
* 🚨 fix warning
* 🚨 fix warning
* 🚨 fix warning
* 👷 use new Docker image
2021-10-29 21:27:34 +02:00
Niels Lohmann
c4a4e672fd
📝 add examples for parsing from iterator pair (#3100 )
2021-10-29 21:26:41 +02:00
Niels Lohmann
80cf9d7065
Revert invalid fix ( #3082 )
...
* ⏪ revert invalid fix
2021-10-16 13:27:28 +02:00
Niels Lohmann
ba046e4ea4
Allow to use get with explicit constructor ( #3079 )
...
* ⏪ remove "fix" that caused #3077
2021-10-14 21:01:14 +02:00
Niels Lohmann
ea528bbfda
📝 fixed Clang version (#3040 )
2021-09-28 12:36:42 +02:00
Niels Lohmann
0b345b20c8
Allow allocators for output_vector_adapter ( #2989 )
...
* ♻️ allow allocators for vectors
* ✅ add regression tests
2021-09-12 18:55:47 +02:00
Niels Lohmann
bbdb29c658
Update docset generation script ( #2967 )
...
* 📝 update docset generation script
* 📝 update documentation
2021-09-01 08:43:10 +02:00
Niels Lohmann
fd0aa4fb0d
👷 re-add Clang 12 (#2986 )
2021-08-30 10:54:14 +02:00
Niels Lohmann
e0b02c355e
Use new Docker image ( #2981 )
2021-08-29 18:05:31 +02:00
Niels Lohmann
34e2c4ab88
📝 add link to Homebrew package (#2966 )
2021-08-22 21:58:37 +02:00
Niels Lohmann
c753165db6
Fix parent update for diagnostics with ordered_json ( #2963 )
...
🐛 fix parent update for diagnostics with ordered_json
2021-08-22 20:30:20 +02:00
Niels Lohmann
f03127eb69
Set stack size for some unit tests when using MSVC ( #2961 )
...
* 🏁 set stack size for some unit tests
2021-08-21 13:55:06 +02:00
Niels Lohmann
cb053bceb1
Merge pull request #2960 from nlohmann/issue2958
...
Add regression test
2021-08-20 16:34:38 +02:00
Niels Lohmann
eb6541a30c
Merge pull request #2959 from nlohmann/issue2938
...
Update Travis badge
2021-08-20 13:56:16 +02:00
Niels Lohmann
611fd22557
Merge pull request #2957 from Hallot/bug/fix-some-clang-warnings
...
Fix some extra ";" clang warnings
2021-08-20 13:32:38 +02:00
Niels Lohmann
44ffaa052c
Merge pull request #2943 from amirmasoudabdol/patch-1
...
Updating the Homebrew Command
2021-08-19 12:03:52 +02:00
Niels Lohmann
273d911252
Merge pull request #2954 from nlohmann/issue2944
2021-08-19 06:37:42 +02:00
Niels Lohmann
abd829e6c6
Merge pull request #2950 from senyai/patch-2
...
🚨 fix gdb_pretty_printer failure on basic types
2021-08-18 20:07:28 +02:00
Niels Lohmann
5cf5ccd108
Merge pull request #2948 from nlohmann/missing_header
...
Add header to use value_t
2021-08-18 20:07:05 +02:00
Niels Lohmann
5a04042cad
Merge pull request #2947 from nlohmann/issue2946
...
Skip some tests if JSON_Install is not set
2021-08-18 20:06:44 +02:00
Niels Lohmann
f8bc22c741
Merge pull request #2945 from nlohmann/issue2941
...
Remove outdated json_unit test binary
2021-08-18 20:06:00 +02:00
Niels Lohmann
de4a6346c7
Merge pull request #2952 from nlohmann/fewer_appveyor_builds
...
Avoid duplicate AppVeyor builds
2021-08-18 20:04:25 +02:00
Niels Lohmann
8cae9d7cd2
Overwork warning flags ( #2936 )
...
* ⚗️ update warning flags
2021-08-17 14:43:43 +02:00
Niels Lohmann
1300d2e4c3
Merge pull request #2908 from nlohmann/issue2863
...
Fix binary subtypes
2021-08-14 14:27:58 +02:00
Niels Lohmann
6ac037c1f6
Merge pull request #2930 from nlohmann/msvc_warnings_as_error
2021-08-13 21:23:24 +02:00
Niels Lohmann
e5ef44c4dd
Merge pull request #2927 from fhuberts/fix-switch-enum
2021-08-13 19:32:39 +02:00
Niels Lohmann
910fabf8f0
Merge pull request #2925 from nlohmann/issue2924
...
Guard GCC pragmas
2021-08-12 07:58:50 +02:00
Niels Lohmann
57d31d1b83
Merge pull request #2898 from nlohmann/issue2824
...
Add regression test
2021-08-11 13:02:49 +02:00
Niels Lohmann
359f6723fc
Merge pull request #2911 from Finkman/develop
...
Supress -Wfloat-equal on intended float comparisions
2021-08-06 12:58:34 +02:00
Niels Lohmann
9ed027ac10
Merge pull request #2902 from nlohmann/issue2893
...
Fix useless-cast warnings
2021-07-31 20:42:55 +02:00
Niels Lohmann
a563338039
Merge pull request #2825 from ldionne/ldionne-lazy
...
Properly constrain the basic_json conversion operator
2021-07-22 12:24:56 +02:00
Niels Lohmann
19a5e12136
CMake cleanup ( #2885 )
...
* 🔥 clean CMake files and Makefile
* 💡 update documentation
2021-07-22 09:25:55 +02:00
Niels Lohmann
eba82ecd62
Refactor Unicode tests ( #2889 )
...
* ♻️ split Unicode tests
2021-07-21 21:17:01 +02:00
Niels Lohmann
8f0a880c89
Merge pull request #2879 from nlohmann/issue2598
...
Avoid string in case of empty CBOR objects
2021-07-17 12:38:33 +02:00
Niels Lohmann
b2d21067d1
Merge pull request #2762 from jpl-mac/no.tidy.warnings.dev
...
Add a cmake option to use SYSTEM in target_include_directories
2021-07-16 12:06:26 +02:00
Niels Lohmann
f907f9502d
Merge pull request #2875 from nlohmann/issue2592
...
Suppress C4127 warning in unit-json_pointer.cpp
2021-07-16 10:11:29 +02:00
Niels Lohmann
c89e23c69b
Merge pull request #2874 from nlohmann/issue2572
...
Fix truncation warning
2021-07-16 07:54:48 +02:00
Niels Lohmann
f883ddd1c2
Merge pull request #2872 from nlohmann/issue2865
...
Fix memory leak in to_json
2021-07-16 06:52:28 +02:00
Niels Lohmann
c9c5c016a2
Merge pull request #2866 from nlohmann/issue2838
2021-07-14 12:04:37 +02:00
Niels Lohmann
4e92a61784
Merge pull request #2795 from turintech/develop
...
Specified git branch for google benchmark fetch in benchmark test
2021-07-13 16:58:25 +02:00
Niels Lohmann
9426074ce8
Merge pull request #2861 from nlohmann/documentation
...
Update documentation
2021-07-11 14:15:41 +02:00
Niels Lohmann
6471a63115
Merge pull request #2729 from theShmoo/without-io
...
Possibility to use without the dependency to file io and streams to use in intel sgx enclaves
2021-06-26 12:50:06 +02:00
Niels Lohmann
624f59eacb
Merge pull request #2826 from justanotheranonymoususer/patch-1
...
Consistency with `using` in README.md
2021-06-21 14:48:39 +02:00
Niels Lohmann
18a5f4c7ca
Merge pull request #2790 from nlohmann/macos_standards
...
Add C++ standards to macOS matrix
2021-06-14 20:23:21 +02:00
Niels Lohmann
71a514a651
Merge pull request #2770 from jasmcaus/patch-1
...
Keep consistent formatting
2021-06-14 07:18:46 +02:00
Niels Lohmann
95ad4ae071
Merge pull request #2817 from nlohmann/fix_ci
...
Fix CI
2021-06-14 07:16:32 +02:00
Niels Lohmann
e10a3fac8a
Merge pull request #2789 from TotalCaesar659/patch-2
...
Update URLs to HTTPS
2021-05-28 10:31:04 +02:00
Niels Lohmann
0972f7ff0e
Merge pull request #2771 from offa/conan_package_url
...
Link to Conan Center package added
2021-05-15 19:26:34 +02:00
Niels Lohmann
fc2f7116fe
Merge pull request #2756 from nlohmann/issue2755
...
replace EOF with std::char_traits<char>::eof()
2021-05-04 12:56:46 +02:00
Niels Lohmann
d4f446592f
Merge pull request #2754 from mortenfyhn/patch-1
...
Fix typo in README
2021-05-03 12:24:55 +02:00
Niels Lohmann
b2e784c33b
Merge pull request #2749 from nlohmann/docs
2021-04-29 23:05:33 +02:00
Niels Lohmann
8a29a6ecf4
Merge pull request #2731 from theShmoo/custom-cpp-version
...
Fixes #2730
2021-04-29 09:55:16 +02:00
Niels Lohmann
07344fdd09
Merge pull request #2747 from nlohmann/docs
...
Add documentation for numbers
2021-04-28 22:06:25 +02:00
Niels Lohmann
a34e011e24
Merge pull request #2576 from AnthonyVH/non_default_constructable_stl_containers
...
Add support for deserialization of STL containers of non-default constructable types (fixes #2574 ).
2021-04-25 15:22:37 +02:00
Niels Lohmann
f1600cd26b
Merge pull request #2737 from nlohmann/upgrade_ci
...
Use Clang 12 in CI
2021-04-25 15:20:42 +02:00
Niels Lohmann
9774e53cd6
Merge pull request #2707 from raduteo/patch-2
...
Update json.hpp
2021-04-23 09:48:38 +02:00
Niels Lohmann
7126d88803
Merge pull request #2690 from doronbehar/patch-1
...
pkg-config.pc.in: Don't concatenate paths
2021-03-30 07:50:28 +02:00
Niels Lohmann
3f33c21725
Merge pull request #2689 from nlohmann/ci_matrix
...
add more CI steps
2021-03-29 09:25:04 +02:00
Niels Lohmann
5213ae56ac
Merge pull request #2687 from musicinmybrain/nonconstant-sigstksz
...
Update doctest from 2.4.4 to 2.4.6 (fixes #2686 )
2021-03-27 07:06:04 +01:00
Niels Lohmann
823801879a
Merge pull request #2683 from nlohmann/license_fix
...
License fix
2021-03-25 13:04:55 +01:00
Niels Lohmann
4a344e1ef0
Merge pull request #2375 from karzhenkov/fix-travis-release
...
Properly select "Release" build for Travis
2021-03-25 12:14:22 +01:00
Niels Lohmann
6f551930e5
🚨 add new CI and fix warnings (#2561 )
...
* ⚗️ move CI targets to CMake
* ♻️ add target for cpplint
* ♻️ add target for self-contained binaries
* ♻️ add targets for iwyu and infer
* 🔊 add version output
* ♻️ add target for oclint
* 🚨 fix warnings
* ♻️ rename targets
* ♻️ use iwyu properly
* 🚨 fix warnings
* ♻️ use iwyu properly
* ♻️ add target for benchmarks
* ♻️ add target for CMake flags
* 👷 use GitHub Actions
* ⚗️ try to install Clang 11
* ⚗️ try to install GCC 11
* ⚗️ try to install Clang 11
* ⚗️ try to install GCC 11
* ⚗️ add clang analyze target
* 🔥 remove Google Benchmark
* ⬆️ Google Benchmark 1.5.2
* 🔥 use fetchcontent
* 🐧 add target to download a Linux version of CMake
* 🔨 fix dependency
* 🚨 fix includes
* 🚨 fix comment
* 🔧 adjust flags for GCC 11.0.0 20210110 (experimental)
* 🐳 user Docker image to run CI
* 🔧 add target for Valgrind
* 👷 add target for Valgrind tests
* ⚗️ add Dart
* ⏪ remove Dart
* ⚗️ do not call ctest in test subdirectory
* ⚗️ download test data explicitly
* ⚗️ only execute Valgrind tests
* ⚗️ fix labels
* 🔥 remove unneeded jobs
* 🔨 cleanup
* 🐛 fix OCLint call
* ✅ add targets for offline and git-independent tests
* ✅ add targets for C++ language versions and reproducible tests
* 🔨 clean up
* 👷 add CI steps for cppcheck and cpplint
* 🚨 fix warnings from Clang-Tidy
* 👷 add CI steps for Clang-Tidy
* 🚨 fix warnings
* 🔧 select proper binary
* 🚨 fix warnings
* 🚨 suppress some unhelpful warnings
* 🚨 fix warnings
* 🎨 fix format
* 🚨 fix warnings
* 👷 add CI steps for Sanitizers
* 🚨 fix warnings
* ⚡ add optimization to sanitizer build
* 🚨 fix warnings
* 🚨 add missing header
* 🚨 fix warnings
* 👷 add CI step for coverage
* 👷 add CI steps for disabled exceptions and implicit conversions
* 🚨 fix warnings
* 👷 add CI steps for checking indentation
* 🐛 fix variable use
* 💚 fix build
* ➖ remove CircleCI
* 👷 add CI step for diagnostics
* 🚨 fix warning
* 🔥 clean Travis
2021-03-24 07:15:18 +01:00
Niels Lohmann
6b74772fe8
Merge pull request #2673 from remyjette/remove-exception-annotation
...
Remove HEDLEY annotation from exception::what()
2021-03-23 07:48:00 +01:00
Niels Lohmann
80e7d6fd9f
Merge pull request #2679 from frasermarlow/patch-1
...
Update parse_exceptions.md - correct `json::exception::parse_error`
2021-03-23 07:44:32 +01:00
Niels Lohmann
098dd6bf34
Merge pull request #2659 from abbaswasim/patch-1
...
Fix amount of entries in the json object
2021-03-23 07:22:44 +01:00
Niels Lohmann
176d8e261a
Merge pull request #2562 from nlohmann/diagnostics
...
Better diagnostics
2021-02-10 07:20:54 +01:00
Niels Lohmann
e754ef7087
Merge pull request #2625 from wawiesel/patch-1
...
Fix missing 1.78 in example in README.md
2021-02-07 14:26:38 +01:00
Niels Lohmann and Alexander Karzhenkov
c190a72f3d
👌 apply suggestion
...
Co-authored-by: Alexander Karzhenkov <karzhenkov@mail.ru >
2021-01-24 17:45:08 +01:00
Niels Lohmann
b83fe5dbf2
Merge pull request #2607 from nlohmann/issue1952
...
Add GDB pretty printer
2021-01-24 13:58:20 +01:00
Niels Lohmann
92fa1d9582
Merge pull request #2582 from bl-ue/patch-1
...
readme: fix tilde character display
2021-01-14 22:11:33 +01:00
Niels Lohmann
68c3696382
Merge pull request #2560 from nlohmann/issue2324
...
Add switch to skip non-reproducible tests.
2020-12-31 14:35:45 +01:00
Niels Lohmann
a8398a7151
Merge pull request #2550 from nlohmann/std_bytes
...
Allow parsing from std::byte containers
2020-12-30 08:33:52 +01:00
Niels Lohmann
ff3863dc1d
Merge pull request #2553 from jasujm/jasujm/input_adapter_custom_container
...
Fix compilation of input_adapter(container) in edge cases
2020-12-29 14:37:20 +01:00
Niels Lohmann
f78d456075
Merge pull request #2540 from karzhenkov/disrupt-cxx17-tests
...
Travis doesn't run any tests in C++17 mode
2020-12-21 20:58:06 +01:00
Niels Lohmann
c3c574cf96
Merge pull request #2538 from YarikTH/feature/doctest_v2.4.3
...
Doctest is updated to v2.4.3
2020-12-18 22:10:42 +01:00
Niels Lohmann
8593260044
Merge pull request #2537 from nlohmann/fix_warnings
...
Fix warnings
2020-12-17 21:48:16 +01:00
Niels Lohmann
af8c6e7aa9
Merge pull request #2533 from nlohmann/c++_future
...
Do not unconditionally redefine C++14 constructs
2020-12-16 20:54:09 +01:00
Niels Lohmann
5c1a5bc9c1
Merge pull request #2534 from nlohmann/clarify_license
...
Clarify license of is_complete_type implementation
2020-12-16 20:53:38 +01:00
Niels Lohmann
45810082d4
Merge pull request #2536 from nlohmann/shadowing
...
Fix a shadowing warning
2020-12-16 20:52:46 +01:00
Niels Lohmann
2fc1f694ad
Merge pull request #2514 from globberwops/develop
...
Add MAIN_PROJECT check for test and install options
2020-12-14 13:41:46 +01:00
Niels Lohmann
be32cc4f5e
Merge pull request #2525 from YarikTH/feature/doctest_v2.4.1
...
Doctest is updated to v2.4.1
2020-12-12 15:08:55 +01:00
Niels Lohmann
260be043ba
Merge pull request #2406 from leozz37/develop
...
📝 add CPM.Cmake example
2020-12-11 14:47:18 +01:00
Niels Lohmann
5026acd70c
Merge pull request #2444 from linev/fix_gcc48_warn
...
Change argument name "subtype" in byte_container_with_subtype
2020-12-11 13:46:41 +01:00
Niels Lohmann
3ad6992f50
Merge pull request #2405 from karzhenkov/fix-json_ref-move
...
Fix move constructor of json_ref
2020-12-11 13:36:33 +01:00
Niels Lohmann
e3643aadf7
Merge pull request #2447 from jbzdarkid/develop
...
Add asserts to suppress C28020
2020-12-11 13:27:52 +01:00