1
0
mirror of https://github.com/nlohmann/json synced 2024-11-24 04:40:13 +00:00
Commit Graph

4612 Commits

Author SHA1 Message Date
Florian Albrechtskirchinger
01af734d63
Attempt to fix labeler permissions (#3674) 2022-08-04 23:38:27 +02:00
Florian Albrechtskirchinger
b13b8748b6
Refine 'Publish documentation' workflow (#3673)
* Only publish documentation when changed

* Enable manual publishing of the documentation

* Don't try to publish documentation from forks
2022-08-04 22:53:05 +02:00
Niels Lohmann
b6e2942d1c
Complete contributor list (#3670)
* 👥 complete contributor list

* Update README.md

Co-authored-by: Florian Albrechtskirchinger <falbrechtskirchinger@gmail.com>
2022-08-04 22:48:30 +02:00
Niels Lohmann
500bdc56bf
Add labeler action (#3671)
👷 add labeler action
2022-08-04 16:46:45 +02:00
Niels Lohmann
98d70d4676
Publish documentation on push to develop branch (#3660)
👷 add job to publish the documentation
2022-08-03 22:28:26 +02:00
Niels Lohmann
22cd1c9eb9
🔧 adjust naming of GitHub action jobs (#3661) 2022-08-03 18:37:02 +02:00
Niels Lohmann
ac20714e2e
👥 complete contributor list (#3662) 2022-08-03 18:36:46 +02:00
Florian Albrechtskirchinger
2ac7d023d4
Add Discord badge to README (#3651) 2022-08-03 09:17:02 +02:00
Florian Albrechtskirchinger
32242022f7
Minor BJData fixes (#3637)
* Replace vector/map LUTs in binary_reader with arrays

* Replace string_t::npos in binary_reader
2022-08-03 09:15:37 +02:00
Florian Albrechtskirchinger
ac9e668e63
Update CI (#3626)
* Bump macos-10.5 runner to macos-11 and update Xcode versions

* Address CodeQL warning

* Only build relevant commits on AppVeyor

* Don't hardcode paths in Ubuntu workflow
2022-08-03 09:15:16 +02:00
Niels Lohmann
df98ca29f8
Merge tag 'v3.11.1' into develop
JSON for Modern C++ 3.11.1
2022-08-01 23:31:54 +02:00
Niels Lohmann
69d744867f
Merge branch 'release/3.11.1' 2022-08-01 23:31:38 +02:00
Niels Lohmann
f2020da0dd
🔖 set version to 3.11.1 2022-08-01 23:27:58 +02:00
Florian Albrechtskirchinger
cbaf1033be
Fix global UDLs (#3646)
* Add ci_test_noglobaludls to CI

* Really default JSON_GLOBAL_UDLS to 1

* Test global UDLs

* Suppress warnings

* Clarify documentation
2022-08-01 22:42:35 +02:00
Niels Lohmann
817a4a2117
Merge tag 'v3.11.0' into develop
JSON for Modern C++ 3.11.0
2022-08-01 13:15:38 +02:00
Niels Lohmann
499422b303
Merge branch 'release/3.11.0' 2022-08-01 13:12:06 +02:00
Niels Lohmann
ce0e13ccea
🔖 set version to 3.11.0 2022-07-31 23:19:06 +02:00
Florian Albrechtskirchinger
9aafcbe965
Move UDLs out of the global namespace (#3605)
* Move UDLs into nlohmann::literals::json_literals namespace

* Add 'using namespace' to unit tests

* Add 'using namespace' to examples

* Add 'using namespace' to README

* Move UDL mkdocs pages out of basic_json/

* Update documentation

* Update docset index

* Add JSON_GlobalUDLs CMake option

* Add unit test

* Build examples without global UDLs

* Add CI target
2022-07-31 17:38:52 +02:00
Niels Lohmann
8fd8b52907
Prepare 3.11.0 release (#3635)
* 📄 add license header

* Update Makefile

Co-authored-by: Florian Albrechtskirchinger <falbrechtskirchinger@gmail.com>

* 🔥 remove unused Doxygen leftover

Co-authored-by: Florian Albrechtskirchinger <falbrechtskirchinger@gmail.com>
2022-07-31 15:28:01 +02:00
Florian Albrechtskirchinger
d3e347bd2d
More documentation updates for 3.11.0 (#3553)
* mkdocs: add string_view examples

* mkdocs: reference underlying operators

* mkdocs: add operator<=> examples

* mkdocs: fix style check issues

* mkdocs: tweak BJData page

* mkdocs: add CMake option hints to macros

* mkdocs: fix JSON_DISABLE_ENUM_SERIALIZATION definition

* mkdocs: fix link to unit-udt.cpp

* mkdocs: fix "Arbitrary Type Conversions" title

* mkdocs: link to api/macros/*.md instead of features/macros.md

* mkdocs: document JSON_DisableEnumSerialization CMake option

* mkdocs: encode required C++ standard in example files

* docset: detect gsed/sed

* docset: update index

* docset: fix CSS patching

* docset: add list_missing_pages make target

* docset: add list_removed_paths make target

* docset: replace page titles with name from index

* docset: add install target for Zeal docset browser

* Use GCC_TOOL in ci_test_documentation target
2022-07-31 14:05:58 +02:00
Niels Lohmann
11ba5c1120
🚨 fix warning (#3634) 2022-07-31 07:23:30 +02:00
Niels Lohmann
9472ab4f84
Add license header to new files (#3633) 2022-07-31 07:22:22 +02:00
Florian Albrechtskirchinger
66c8bb5b90
Add a unit test including windows.h (#3631) 2022-07-31 07:22:07 +02:00
Florian Albrechtskirchinger
19e4c2bda0
Add regression tests for #3204 and #3333 (#3629) 2022-07-31 07:21:48 +02:00
KsaNL
fc3e64cbf9
Fixed latest build error in msvc platform (#3630)
* Fixed latest build error in msvc platform

warnings in msvc about mix/max macro while windows.h is used in the project #762

* Update for CI

None

* Update single_include/nlohmann/json.hpp

Co-authored-by: Florian Albrechtskirchinger <falbrechtskirchinger@gmail.com>

Co-authored-by: Florian Albrechtskirchinger <falbrechtskirchinger@gmail.com>
2022-07-30 23:03:09 +02:00
Florian Albrechtskirchinger
a2578d1d50
Disable exceptions on ICPC (#3621) 2022-07-30 22:10:49 +02:00
Florian Albrechtskirchinger
d909f80960
Add versioned, ABI-tagged inline namespace and namespace macros (#3590)
* Add versioned inline namespace

Add a versioned inline namespace to prevent ABI issues when linking code
using multiple library versions.

* Add namespace macros

* Encode ABI information in inline namespace

Add _diag suffix to inline namespace if JSON_DIAGNOSTICS is enabled, and
_ldvcmp suffix if JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON is enabled.

* Move ABI-affecting macros into abi_macros.hpp

* Move std_fs namespace definition into std_fs.hpp

* Remove std_fs namespace from unit test

* Format more files in tests directory

* Add unit tests

* Update documentation

* Fix GDB pretty printer

* fixup! Add namespace macros

* Derive ABI prefix from NLOHMANN_JSON_VERSION_*
2022-07-30 21:59:13 +02:00
Florian Albrechtskirchinger
fca1ddda96
Fix patch::add creating nonexistent parents (#3628)
* Fix patch::add creating nonexistent parents

The previous behavior was not in accordance with RFC6902.
Add unit test.

Fixes #3134.

* Fix incorrect JSON patch unit test

Co-authored-by: Hudson00 <yagdhscdasg@gmail.com>
2022-07-30 21:23:55 +02:00
Niels Lohmann
d1d79b930d
Adjust JSON Pointer examples (#3622)
* 📝 adjust JSON Pointer examples

* 👷 add test for documentation

* 📝 note platform-dependent output on some examples
2022-07-29 14:28:37 +02:00
Andrea Pappacoda
6576c3f776
build: install .pc and .cmake files to share/ (#3619)
As nlohmann_json is a header-only library, its pkg-config and cmake
config files should be installed to `share/` (GNUInstallDirs' DATADIR),
as `share/` is the canonical directory where architecture-independent
files should be stored, while `lib/` is for architecture-dependent stuff
(see the [FHS][]).

Apart from being technically correct, installing to `share/` can help
with cross-compiling, for example in Debian-based environments. If
you're interested, I'd suggest reading this [thread][].

Related to #1697

[FHS]: https://refspecs.linuxfoundation.org/FHS_3.0/fhs-3.0.html#usrshareArchitectureindependentData
[thread]: https://github.com/marzer/tomlplusplus/pull/165#issuecomment-1193146210
2022-07-29 07:43:22 +02:00
Florian Albrechtskirchinger
e3095f636f
Add operator<<(json_pointer) (#3601)
* Add operator<< for json_pointer

* Deprecate json_pointer::operator string_t()

* Update documentation

* Move operator<<(basic_json) example

* Add example

* Add mkdocs-redirects

* Move operator<< and operator>> doc pages out of basic_json/

* Rename JSON pointer operator_string to operator_string_t

* Add unit test
2022-07-28 22:12:23 +02:00
Florian Albrechtskirchinger
7777300442
Install MinGW from GitHub NuGet registry (#3618)
Attempt to workaround recent, frequent failures of the MinGW jobs by
installing an internalized Chocolatey package hosted on GitHub.
2022-07-28 21:54:12 +02:00
Florian Albrechtskirchinger
a87c1885cb
Re-add value_type detection to distinguish string types (#3604)
* Re-add value_type detection to is_constructible_string_type trait

* Add value_type detection to from_json for strings
2022-07-28 21:52:23 +02:00
Florian Albrechtskirchinger
a714381a5f
Use swap() by ADL (#3609)
* Use swap() by ADL

* Add type to swap() exception messages
2022-07-28 21:51:45 +02:00
Florian Albrechtskirchinger
298e4a9449
Use concurrency (#3610)
Use concurrency in GitHub workflows to cancel in-progress or pending
runs for the same ref.
2022-07-28 21:51:32 +02:00
Florian Albrechtskirchinger
5520761433
Fix Unicode test timeout (for real this time!) (#3614)
* Use TIMEOUT instead of TIMEOUT_AFTER_MATCH to set test timeout
2022-07-28 21:51:11 +02:00
Niels Lohmann
2d48a4d9c5
Add documentation for comparing json and ordered_json (#3599)
* 📝 add documentation for #3443

* Apply suggestions from code review

Co-authored-by: Florian Albrechtskirchinger <falbrechtskirchinger@gmail.com>
2022-07-23 20:54:40 +02:00
Florian Albrechtskirchinger
e91686cc17
Make sure iterator_input_adapter advances iterators correctly (#3548)
When parsing a string containing two JSON values using iterators, after
parsing, iterator_input_adapter should have advanced to the first
character of the second value.
Add a unit test to check that this is true.
2022-07-23 14:36:10 +02:00
Niels Lohmann
dbfd33a70a
Add assertion if nullptr is passed to parse function (#3593)
Addresses #3584
2022-07-23 01:26:51 +02:00
Niels Lohmann
b185c5bc9d
📝 clean up after #3581 (#3596) 2022-07-22 15:35:29 +02:00
Wolf Vollprecht
09fb4819ff
add patch_inplace function (#3581)
* add patch_inplace function to json class

* add documentation

* fix up docs
2022-07-21 16:27:59 +02:00
Niels Lohmann
4b6d3638ca
📝 minor fixes (#3592) 2022-07-20 18:59:04 +02:00
Niels Lohmann
feef0eb595
Add error message if test suite cannot be found (#3585)
* 🚸 add error message if test suite cannot be found

Fixes #3584
2022-07-20 12:41:33 +02:00
Niels Lohmann
527da54dcb
Use REUSE framework (#3546)
* 📄 add licenses

* 👷 add REUSE compliance check

* 📝 add badge for REUSE

Co-authored-by: Florian Albrechtskirchinger <falbrechtskirchinger@gmail.com>
2022-07-20 12:38:07 +02:00
Jake Zimmerman
2a9ae2b487
Make certain usage patterns more prominent in the README (#3557)
* Make certain usage patterns more prominent in the README

We use this library extensively where I work. After pairing with many
teammates, I've learned that one common stumbling point when using this
library is how to first get a JSON value in the first place (because
once they have a variable of type `json` in hand, the API is intuitive
and mostly does what you expect).

With that in mind, I've added two subsections to the top of the Examples
section: how to read JSON from a file, and how to hardcode a JSON
literal.

I understand that these are already documented elsewhere in the Examples
section, and so these new subsections are technically redundant. But to
defend this choice:

- Redundancy in docs is actually good, because not everyone consumes
  docs in the same way or in the same order.

- Having these things called out explicitly in isolation encourages
  people to get something working faster. In later sections, these
  examples are presented alongside many other options. Having to choose
  between alternatives gets in the way of quickly prototyping something.

If you have further suggestions for how to improve or modify these docs
I'm open to them. The changes included here would really make a huge
improvement in the productivity of newer members of my team using this
library.

* Remove old TOC entry

* Put the section back

* Another tweak
2022-07-18 17:55:44 +02:00
Niels Lohmann
a15683e348
📝 add badge for https://repology.org/project/nlohmann-json/versions (#3586) 2022-07-18 17:48:42 +02:00
NN
d64d40518c
Ignore output directory (#3572)
* Ignore output directory

* Update .gitignore

Co-authored-by: Niels Lohmann <niels.lohmann@gmail.com>

Co-authored-by: Niels Lohmann <niels.lohmann@gmail.com>
2022-07-17 13:43:55 +02:00
Florian Albrechtskirchinger
71bdaf5748
Enable overriding test properties and set Unicode test timeouts (#3580)
* CMake: Add TEST_PROPERTIES to json_test_set_test_options()

Allow overriding test properties via json_test_set_test_options().

* CMake: Set timeouts for Unicode tests
2022-07-17 13:43:32 +02:00
Romain Reignier
d4daaa897f
Optimize output vector adapter write (#3569)
* Add benchmark for cbor serialization and cbor binary data serialization

* Use std::vector::insert method instead of std::copy in output_vector_adapter::write_characters

This change increases a lot the performance when writing lots of binary data.
2022-07-08 08:12:00 +02:00
Florian Albrechtskirchinger
7d361ec8ef
Add overloads for more key types to ordered_map and fix ordered_map::erase(first, last) with first == last (#3564)
* Add overloads for more key types to ordered_map

Add overloads to accept additional key types defined by type trait
detail::is_usable_as_key_type to ordered_map.
The same key types that can be used with json can now also be used with
ordered_json.

* Fix ordered_map::erase(first, last) with first == last

* Modify element access unit test to also test ordered_json
2022-07-04 19:58:19 +02:00