Merge branch 'release/3.11.2'
This commit is contained in:
commit
bc889afb4c
8
.github/CONTRIBUTING.md
vendored
8
.github/CONTRIBUTING.md
vendored
@ -22,17 +22,17 @@ Clearly describe the issue:
|
|||||||
- If you propose a change or addition, try to give an **example** how the improved code could look like or how to use it.
|
- If you propose a change or addition, try to give an **example** how the improved code could look like or how to use it.
|
||||||
- If you found a compilation error, please tell us which **compiler** (version and operating system) you used and paste the (relevant part of) the error messages to the ticket.
|
- If you found a compilation error, please tell us which **compiler** (version and operating system) you used and paste the (relevant part of) the error messages to the ticket.
|
||||||
|
|
||||||
Please stick to the provided issue templates ([bug report](https://github.com/nlohmann/json/blob/develop/.github/ISSUE_TEMPLATE/Bug_report.md), [feature request](https://github.com/nlohmann/json/blob/develop/.github/ISSUE_TEMPLATE/Feature_request.md), or [question](https://github.com/nlohmann/json/blob/develop/.github/ISSUE_TEMPLATE/question.md)) if possible.
|
Please stick to the provided issue template ([bug report](https://github.com/nlohmann/json/blob/develop/.github/ISSUE_TEMPLATE/bug.yml) if possible. For questions, feature or support requests, please [open a discussion](https://github.com/nlohmann/json/discussions/new).
|
||||||
|
|
||||||
## Files to change
|
## Files to change
|
||||||
|
|
||||||
:exclamation: Before you make any changes, note the single-header file [`single_include/nlohmann/json.hpp`](https://github.com/nlohmann/json/blob/develop/single_include/nlohmann/json.hpp) is **generated** from the source files in the [`include/nlohmann` directory](https://github.com/nlohmann/json/tree/develop/include/nlohmann). Please **do not** edit file `single_include/nlohmann/json.hpp` directly, but change the `include/nlohmann` sources and regenerate file `single_include/nlohmann/json.hpp` by executing `make amalgamate`.
|
:exclamation: Before you make any changes, note the single-header files [`single_include/nlohmann/json.hpp`](https://github.com/nlohmann/json/blob/develop/single_include/nlohmann/json.hpp) and [`single_include/nlohmann/json_fwd.hpp`](https://github.com/nlohmann/json/blob/develop/single_include/nlohmann/json_fwd.hpp) are **generated** from the source files in the [`include/nlohmann` directory](https://github.com/nlohmann/json/tree/develop/include/nlohmann). Please **do not** edit the files `single_include/nlohmann/json.hpp` and `single_include/nlohmann/json_fwd.hpp` directly, but change the `include/nlohmann` sources and regenerate the files by executing `make amalgamate`.
|
||||||
|
|
||||||
To make changes, you need to edit the following files:
|
To make changes, you need to edit the following files:
|
||||||
|
|
||||||
1. [`include/nlohmann/*`](https://github.com/nlohmann/json/tree/develop/include/nlohmann) - These files are the sources of the library. Before testing or creating a pull request, execute `make amalgamate` to regenerate `single_include/nlohmann/json.hpp`.
|
1. [`include/nlohmann/*`](https://github.com/nlohmann/json/tree/develop/include/nlohmann) - These files are the sources of the library. Before testing or creating a pull request, execute `make amalgamate` to regenerate `single_include/nlohmann/json.hpp` and `single_include/nlohmann/json_fwd.hpp`.
|
||||||
|
|
||||||
2. [`test/src/unit-*.cpp`](https://github.com/nlohmann/json/tree/develop/test/src) - These files contain the [doctest](https://github.com/onqtam/doctest) unit tests which currently cover [100 %](https://coveralls.io/github/nlohmann/json) of the library's code.
|
2. [`tests/src/unit-*.cpp`](https://github.com/nlohmann/json/tree/develop/tests/src) - These files contain the [doctest](https://github.com/onqtam/doctest) unit tests which currently cover [100 %](https://coveralls.io/github/nlohmann/json) of the library's code.
|
||||||
|
|
||||||
If you add or change a feature, please also add a unit test to this file. The unit tests can be compiled and executed with
|
If you add or change a feature, please also add a unit test to this file. The unit tests can be compiled and executed with
|
||||||
|
|
||||||
|
|||||||
2
.github/ISSUE_TEMPLATE/bug.yaml
vendored
2
.github/ISSUE_TEMPLATE/bug.yaml
vendored
@ -76,7 +76,7 @@ body:
|
|||||||
label: Library version
|
label: Library version
|
||||||
description: >
|
description: >
|
||||||
Which version of the library did you use? If it is a released version,
|
Which version of the library did you use? If it is a released version,
|
||||||
please enter the version number (e.g., 3.11.1). Otherwise, please enter
|
please enter the version number (e.g., 3.11.2). Otherwise, please enter
|
||||||
the commit hash. If you got the library from another source as the
|
the commit hash. If you got the library from another source as the
|
||||||
GitHub repository (e.g., via a package manager), please also state
|
GitHub repository (e.g., via a package manager), please also state
|
||||||
this.
|
this.
|
||||||
|
|||||||
2
.github/PULL_REQUEST_TEMPLATE.md
vendored
2
.github/PULL_REQUEST_TEMPLATE.md
vendored
@ -9,7 +9,7 @@ Read the [Contribution Guidelines](https://github.com/nlohmann/json/blob/develop
|
|||||||
- [ ] Changes are described in the pull request, or an [existing issue is referenced](https://github.com/nlohmann/json/issues).
|
- [ ] Changes are described in the pull request, or an [existing issue is referenced](https://github.com/nlohmann/json/issues).
|
||||||
- [ ] The test suite [compiles and runs](https://github.com/nlohmann/json/blob/develop/README.md#execute-unit-tests) without error.
|
- [ ] The test suite [compiles and runs](https://github.com/nlohmann/json/blob/develop/README.md#execute-unit-tests) without error.
|
||||||
- [ ] [Code coverage](https://coveralls.io/github/nlohmann/json) is 100%. Test cases can be added by editing the [test suite](https://github.com/nlohmann/json/tree/develop/test/src).
|
- [ ] [Code coverage](https://coveralls.io/github/nlohmann/json) is 100%. Test cases can be added by editing the [test suite](https://github.com/nlohmann/json/tree/develop/test/src).
|
||||||
- [ ] The source code is amalgamated; that is, after making changes to the sources in the `include/nlohmann` directory, run `make amalgamate` to create the single-header file `single_include/nlohmann/json.hpp`. The whole process is described [here](https://github.com/nlohmann/json/blob/develop/.github/CONTRIBUTING.md#files-to-change).
|
- [ ] The source code is amalgamated; that is, after making changes to the sources in the `include/nlohmann` directory, run `make amalgamate` to create the single-header files `single_include/nlohmann/json.hpp` and `single_include/nlohmann/json_fwd.hpp`. The whole process is described [here](https://github.com/nlohmann/json/blob/develop/.github/CONTRIBUTING.md#files-to-change).
|
||||||
|
|
||||||
## Please don't
|
## Please don't
|
||||||
|
|
||||||
|
|||||||
20
.github/external_ci/appveyor.yml
vendored
20
.github/external_ci/appveyor.yml
vendored
@ -1,5 +1,19 @@
|
|||||||
version: '{build}'
|
version: '{build}'
|
||||||
|
|
||||||
|
# only build PRs and commits to develop branch
|
||||||
|
# (see https://help.appveyor.com/discussions/questions/55079-two-builds-per-commit-to-pull-request)
|
||||||
|
branches:
|
||||||
|
only:
|
||||||
|
- develop
|
||||||
|
|
||||||
|
only_commits:
|
||||||
|
files:
|
||||||
|
- .github/external_ci/appveyor.yml
|
||||||
|
- cmake/
|
||||||
|
- include/
|
||||||
|
- tests/
|
||||||
|
- CMakeLists.txt
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
matrix:
|
matrix:
|
||||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||||
@ -75,9 +89,3 @@ test_script:
|
|||||||
# occasional timeouts on AppVeyor.
|
# occasional timeouts on AppVeyor.
|
||||||
# More info: https://github.com/nlohmann/json/pull/1570
|
# More info: https://github.com/nlohmann/json/pull/1570
|
||||||
- if "%configuration%"=="Debug" ctest --exclude-regex "test-unicode" -C "%configuration%" --parallel 2 --output-on-failure
|
- if "%configuration%"=="Debug" ctest --exclude-regex "test-unicode" -C "%configuration%" --parallel 2 --output-on-failure
|
||||||
|
|
||||||
# only build PRs and commits to develop branch
|
|
||||||
# (see https://help.appveyor.com/discussions/questions/55079-two-builds-per-commit-to-pull-request)
|
|
||||||
branches:
|
|
||||||
only:
|
|
||||||
- develop
|
|
||||||
|
|||||||
38
.github/labeler.yml
vendored
Normal file
38
.github/labeler.yml
vendored
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
version: 1
|
||||||
|
|
||||||
|
labels:
|
||||||
|
- label: "documentation"
|
||||||
|
files:
|
||||||
|
- "README.md"
|
||||||
|
|
||||||
|
- label: "documentation"
|
||||||
|
files:
|
||||||
|
- "docs/.*"
|
||||||
|
|
||||||
|
- label: "tests"
|
||||||
|
files:
|
||||||
|
- "tests/.*"
|
||||||
|
|
||||||
|
- label: "CMake"
|
||||||
|
files:
|
||||||
|
- ".*CMakeLists.txt"
|
||||||
|
|
||||||
|
- label: "CMake"
|
||||||
|
files:
|
||||||
|
- "cmake/.*"
|
||||||
|
|
||||||
|
- label: "CI"
|
||||||
|
files:
|
||||||
|
- "github/workflows/.*"
|
||||||
|
|
||||||
|
- label: "CI"
|
||||||
|
files:
|
||||||
|
- "github/external_ci/.*"
|
||||||
|
|
||||||
|
- label: "S"
|
||||||
|
size-below: 10
|
||||||
|
- label: "M"
|
||||||
|
size-above: 9
|
||||||
|
size-below: 100
|
||||||
|
- label: "L"
|
||||||
|
size-above: 100
|
||||||
23
.github/workflows/codeql-analysis.yml
vendored
23
.github/workflows/codeql-analysis.yml
vendored
@ -23,38 +23,15 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
|
||||||
# We must fetch at least the immediate parents so that if this is
|
|
||||||
# a pull request then we can check out the head.
|
|
||||||
fetch-depth: 2
|
|
||||||
|
|
||||||
# If this run was triggered by a pull request event, then checkout
|
|
||||||
# the head of the pull request instead of the merge commit.
|
|
||||||
- run: git checkout HEAD^2
|
|
||||||
if: ${{ github.event_name == 'pull_request' }}
|
|
||||||
|
|
||||||
# Initializes the CodeQL tools for scanning.
|
# Initializes the CodeQL tools for scanning.
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
uses: github/codeql-action/init@v2
|
uses: github/codeql-action/init@v2
|
||||||
# Override language selection by uncommenting this and choosing your languages
|
|
||||||
# with:
|
|
||||||
# languages: go, javascript, csharp, python, cpp, java
|
|
||||||
|
|
||||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||||
# If this step fails, then you should remove it and run the build manually (see below)
|
# If this step fails, then you should remove it and run the build manually (see below)
|
||||||
- name: Autobuild
|
- name: Autobuild
|
||||||
uses: github/codeql-action/autobuild@v2
|
uses: github/codeql-action/autobuild@v2
|
||||||
|
|
||||||
# ℹ️ Command-line programs to run using the OS shell.
|
|
||||||
# 📚 https://git.io/JvXDl
|
|
||||||
|
|
||||||
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
|
||||||
# and modify them (or add more) to build your code if your project
|
|
||||||
# uses a compiled language
|
|
||||||
|
|
||||||
#- run: |
|
|
||||||
# make bootstrap
|
|
||||||
# make release
|
|
||||||
|
|
||||||
- name: Perform CodeQL Analysis
|
- name: Perform CodeQL Analysis
|
||||||
uses: github/codeql-action/analyze@v2
|
uses: github/codeql-action/analyze@v2
|
||||||
|
|||||||
18
.github/workflows/labeler.yml
vendored
Normal file
18
.github/workflows/labeler.yml
vendored
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
name: "Pull Request Labeler"
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request_target:
|
||||||
|
types: [opened, synchronize]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
label:
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
pull-requests: write
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: srvaroa/labeler@master
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
||||||
24
.github/workflows/macos.yml
vendored
24
.github/workflows/macos.yml
vendored
@ -15,37 +15,37 @@ concurrency:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
xcode_1:
|
xcode_1:
|
||||||
runs-on: macos-10.15
|
runs-on: macos-11
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
xcode: [12.4, 12.3, 12.2, 12.1.1, 12.1, 12, 11.7, 11.6, 11.5, 11.4.1, 11.3.1, 11.2.1, 10.3]
|
xcode: ['11.7', '12.4', '12.5.1', '13.0']
|
||||||
env:
|
env:
|
||||||
DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer
|
DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- name: cmake
|
- name: Run CMake
|
||||||
run: cmake -S . -B build -D CMAKE_BUILD_TYPE=Debug -DJSON_BuildTests=On -DJSON_FastTests=ON
|
run: cmake -S . -B build -D CMAKE_BUILD_TYPE=Debug -DJSON_BuildTests=On -DJSON_FastTests=ON
|
||||||
- name: build
|
- name: Build
|
||||||
run: cmake --build build --parallel 10
|
run: cmake --build build --parallel 10
|
||||||
- name: test
|
- name: Test
|
||||||
run: cd build ; ctest -j 10 --output-on-failure
|
run: cd build ; ctest -j 10 --output-on-failure
|
||||||
|
|
||||||
xcode_2:
|
xcode_2:
|
||||||
runs-on: macos-12
|
runs-on: macos-12
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
xcode: [13.3.1, 13.3, 13.2.1, 13.2, 13.1]
|
xcode: ['13.1', '13.2.1', '13.3.1', '13.4.1']
|
||||||
env:
|
env:
|
||||||
DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer
|
DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- name: cmake
|
- name: Run CMake
|
||||||
run: cmake -S . -B build -D CMAKE_BUILD_TYPE=Debug -DJSON_BuildTests=On -DJSON_FastTests=ON
|
run: cmake -S . -B build -D CMAKE_BUILD_TYPE=Debug -DJSON_BuildTests=On -DJSON_FastTests=ON
|
||||||
- name: build
|
- name: Build
|
||||||
run: cmake --build build --parallel 10
|
run: cmake --build build --parallel 10
|
||||||
- name: test
|
- name: Test
|
||||||
run: cd build ; ctest -j 10 --output-on-failure
|
run: cd build ; ctest -j 10 --output-on-failure
|
||||||
|
|
||||||
xcode_standards:
|
xcode_standards:
|
||||||
@ -58,9 +58,9 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- name: cmake
|
- name: Run CMake
|
||||||
run: cmake -S . -B build -D CMAKE_BUILD_TYPE=Debug -DJSON_BuildTests=On -DJSON_TestStandards=${{ matrix.standard }}
|
run: cmake -S . -B build -D CMAKE_BUILD_TYPE=Debug -DJSON_BuildTests=On -DJSON_TestStandards=${{ matrix.standard }}
|
||||||
- name: build
|
- name: Build
|
||||||
run: cmake --build build --parallel 10
|
run: cmake --build build --parallel 10
|
||||||
- name: test
|
- name: Test
|
||||||
run: cd build ; ctest -j 10 --output-on-failure
|
run: cd build ; ctest -j 10 --output-on-failure
|
||||||
|
|||||||
32
.github/workflows/publish_documentation.yml
vendored
Normal file
32
.github/workflows/publish_documentation.yml
vendored
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
name: Publish documentation
|
||||||
|
|
||||||
|
# publish the documentation on every merge to develop branch
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- develop
|
||||||
|
paths:
|
||||||
|
- docs/mkdocs/**
|
||||||
|
- docs/examples/**
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
# we don't want to have concurrent jobs, and we don't want to cancel running jobs to avoid broken publications
|
||||||
|
concurrency:
|
||||||
|
group: documentation
|
||||||
|
cancel-in-progress: false
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
publish_documentation:
|
||||||
|
if: github.repository == 'nlohmann/json'
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Install and update PlantUML
|
||||||
|
run: sudo apt-get update ; sudo apt-get install -y plantuml
|
||||||
|
|
||||||
|
- name: Install virtual environment
|
||||||
|
run: make install_venv -C docs/mkdocs
|
||||||
|
|
||||||
|
- name: Publish documentation
|
||||||
|
run: make publish -C docs/mkdocs
|
||||||
62
.github/workflows/ubuntu.yml
vendored
62
.github/workflows/ubuntu.yml
vendored
@ -19,9 +19,9 @@ jobs:
|
|||||||
container: ghcr.io/nlohmann/json-ci:v2.4.0
|
container: ghcr.io/nlohmann/json-ci:v2.4.0
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- name: cmake
|
- name: Run CMake
|
||||||
run: cmake -S . -B build -DJSON_CI=On
|
run: cmake -S . -B build -DJSON_CI=On
|
||||||
- name: build
|
- name: Build
|
||||||
run: cmake --build build --target ci_test_clang
|
run: cmake --build build --target ci_test_clang
|
||||||
|
|
||||||
ci_test_gcc:
|
ci_test_gcc:
|
||||||
@ -29,9 +29,9 @@ jobs:
|
|||||||
container: ghcr.io/nlohmann/json-ci:v2.4.0
|
container: ghcr.io/nlohmann/json-ci:v2.4.0
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- name: cmake
|
- name: Run CMake
|
||||||
run: cmake -S . -B build -DJSON_CI=On
|
run: cmake -S . -B build -DJSON_CI=On
|
||||||
- name: build
|
- name: Build
|
||||||
run: cmake --build build --target ci_test_gcc
|
run: cmake --build build --target ci_test_gcc
|
||||||
|
|
||||||
ci_static_analysis:
|
ci_static_analysis:
|
||||||
@ -42,9 +42,9 @@ jobs:
|
|||||||
target: [ci_clang_tidy, ci_cppcheck, ci_test_valgrind, ci_test_clang_sanitizer, ci_test_amalgamation, ci_clang_analyze, ci_cpplint, ci_cmake_flags, ci_single_binaries, ci_reproducible_tests, ci_non_git_tests, ci_offline_testdata, ci_infer]
|
target: [ci_clang_tidy, ci_cppcheck, ci_test_valgrind, ci_test_clang_sanitizer, ci_test_amalgamation, ci_clang_analyze, ci_cpplint, ci_cmake_flags, ci_single_binaries, ci_reproducible_tests, ci_non_git_tests, ci_offline_testdata, ci_infer]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- name: cmake
|
- name: Run CMake
|
||||||
run: cmake -S . -B build -DJSON_CI=On
|
run: cmake -S . -B build -DJSON_CI=On
|
||||||
- name: build
|
- name: Build
|
||||||
run: cmake --build build --target ${{ matrix.target }}
|
run: cmake --build build --target ${{ matrix.target }}
|
||||||
|
|
||||||
ci_test_single_header:
|
ci_test_single_header:
|
||||||
@ -52,9 +52,9 @@ jobs:
|
|||||||
container: ghcr.io/nlohmann/json-ci:v2.4.0
|
container: ghcr.io/nlohmann/json-ci:v2.4.0
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- name: cmake
|
- name: Run CMake
|
||||||
run: cmake -S . -B build -DJSON_CI=On
|
run: cmake -S . -B build -DJSON_CI=On
|
||||||
- name: build
|
- name: Build
|
||||||
run: cmake --build build --target ci_test_single_header
|
run: cmake --build build --target ci_test_single_header
|
||||||
|
|
||||||
ci_cmake_options:
|
ci_cmake_options:
|
||||||
@ -65,9 +65,9 @@ jobs:
|
|||||||
target: [ci_test_diagnostics, ci_test_noexceptions, ci_test_noimplicitconversions, ci_test_legacycomparison, ci_test_noglobaludls]
|
target: [ci_test_diagnostics, ci_test_noexceptions, ci_test_noimplicitconversions, ci_test_legacycomparison, ci_test_noglobaludls]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- name: cmake
|
- name: Run CMake
|
||||||
run: cmake -S . -B build -DJSON_CI=On
|
run: cmake -S . -B build -DJSON_CI=On
|
||||||
- name: build
|
- name: Build
|
||||||
run: cmake --build build --target ${{ matrix.target }}
|
run: cmake --build build --target ${{ matrix.target }}
|
||||||
|
|
||||||
ci_test_coverage:
|
ci_test_coverage:
|
||||||
@ -75,20 +75,20 @@ jobs:
|
|||||||
container: ghcr.io/nlohmann/json-ci:v2.4.0
|
container: ghcr.io/nlohmann/json-ci:v2.4.0
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- name: cmake
|
- name: Run CMake
|
||||||
run: cmake -S . -B build -DJSON_CI=On
|
run: cmake -S . -B build -DJSON_CI=On
|
||||||
- name: build
|
- name: Build
|
||||||
run: cmake --build build --target ci_test_coverage
|
run: cmake --build build --target ci_test_coverage
|
||||||
- name: archive coverage report
|
- name: Archive coverage report
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: code-coverage-report
|
name: code-coverage-report
|
||||||
path: /__w/json/json/build/html
|
path: ${{ github.workspace }}/build/html
|
||||||
- name: Coveralls
|
- name: Publish report to Coveralls
|
||||||
uses: coverallsapp/github-action@master
|
uses: coverallsapp/github-action@master
|
||||||
with:
|
with:
|
||||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
path-to-lcov: /__w/json/json/build/json.info.filtered.noexcept
|
path-to-lcov: ${{ github.workspace }}/build/json.info.filtered.noexcept
|
||||||
|
|
||||||
ci_test_compilers:
|
ci_test_compilers:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@ -98,9 +98,9 @@ jobs:
|
|||||||
compiler: [g++-4.8, g++-4.9, g++-5, g++-6, g++-7, g++-8, g++-9, g++-10, g++-11, clang++-3.5, clang++-3.6, clang++-3.7, clang++-3.8, clang++-3.9, clang++-4.0, clang++-5.0, clang++-6.0, clang++-7, clang++-8, clang++-9, clang++-10, clang++-11, clang++-12, clang++-13, clang++-14]
|
compiler: [g++-4.8, g++-4.9, g++-5, g++-6, g++-7, g++-8, g++-9, g++-10, g++-11, clang++-3.5, clang++-3.6, clang++-3.7, clang++-3.8, clang++-3.9, clang++-4.0, clang++-5.0, clang++-6.0, clang++-7, clang++-8, clang++-9, clang++-10, clang++-11, clang++-12, clang++-13, clang++-14]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- name: cmake
|
- name: Run CMake
|
||||||
run: cmake -S . -B build -DJSON_CI=On
|
run: cmake -S . -B build -DJSON_CI=On
|
||||||
- name: build
|
- name: Build
|
||||||
run: cmake --build build --target ci_test_compiler_${{ matrix.compiler }}
|
run: cmake --build build --target ci_test_compiler_${{ matrix.compiler }}
|
||||||
|
|
||||||
ci_test_standards:
|
ci_test_standards:
|
||||||
@ -112,9 +112,9 @@ jobs:
|
|||||||
compiler: [gcc, clang]
|
compiler: [gcc, clang]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- name: cmake
|
- name: Run CMake
|
||||||
run: cmake -S . -B build -DJSON_CI=On
|
run: cmake -S . -B build -DJSON_CI=On
|
||||||
- name: build
|
- name: Build
|
||||||
run: cmake --build build --target ci_test_${{ matrix.compiler }}_cxx${{ matrix.standard }}
|
run: cmake --build build --target ci_test_${{ matrix.compiler }}_cxx${{ matrix.standard }}
|
||||||
|
|
||||||
ci_cuda_example:
|
ci_cuda_example:
|
||||||
@ -122,9 +122,9 @@ jobs:
|
|||||||
container: ghcr.io/nlohmann/json-ci:v2.4.0
|
container: ghcr.io/nlohmann/json-ci:v2.4.0
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- name: cmake
|
- name: Run CMake
|
||||||
run: cmake -S . -B build -DJSON_CI=On
|
run: cmake -S . -B build -DJSON_CI=On
|
||||||
- name: build
|
- name: Build
|
||||||
run: cmake --build build --target ci_cuda_example
|
run: cmake --build build --target ci_cuda_example
|
||||||
|
|
||||||
ci_icpc:
|
ci_icpc:
|
||||||
@ -132,27 +132,31 @@ jobs:
|
|||||||
container: ghcr.io/nlohmann/json-ci:v2.2.0
|
container: ghcr.io/nlohmann/json-ci:v2.2.0
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: cmake
|
- name: Run CMake
|
||||||
run: cmake -S . -B build -DJSON_CI=On
|
run: cmake -S . -B build -DJSON_CI=On
|
||||||
- name: build
|
- name: Build
|
||||||
run: |
|
run: |
|
||||||
. /opt/intel/oneapi/setvars.sh
|
. /opt/intel/oneapi/setvars.sh
|
||||||
cmake --build build --target ci_icpc
|
cmake --build build --target ci_icpc
|
||||||
|
|
||||||
ci_reuse_compliance:
|
ci_reuse_compliance:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-python@v3
|
- uses: actions/setup-python@v3
|
||||||
- name: install REUSE tool
|
- name: Install REUSE tool
|
||||||
run: python -m pip install reuse
|
run: python -m pip install reuse
|
||||||
- name: REUSE lint
|
- name: Run REUSE lint
|
||||||
run: reuse lint
|
run: reuse lint
|
||||||
|
|
||||||
ci_test_documentation:
|
ci_test_documentation:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
target: [ci_test_examples, ci_test_api_documentation]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- name: cmake
|
- name: Run CMake
|
||||||
run: cmake -S . -B build -DJSON_CI=On
|
run: cmake -S . -B build -DJSON_CI=On
|
||||||
- name: build
|
- name: Build
|
||||||
run: cmake --build build --target ci_test_documentation
|
run: cmake --build build --target ${{ matrix.target }}
|
||||||
|
|||||||
48
.github/workflows/windows.yml
vendored
48
.github/workflows/windows.yml
vendored
@ -47,11 +47,11 @@ jobs:
|
|||||||
# uses: egor-tensin/setup-mingw@v2
|
# uses: egor-tensin/setup-mingw@v2
|
||||||
# with:
|
# with:
|
||||||
# platform: ${{ matrix.architecture }}
|
# platform: ${{ matrix.architecture }}
|
||||||
- name: cmake
|
- name: Run CMake
|
||||||
run: cmake -S . -B build -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Debug -DJSON_BuildTests=On
|
run: cmake -S . -B build -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Debug -DJSON_BuildTests=On
|
||||||
- name: build
|
- name: Build
|
||||||
run: cmake --build build --parallel 10
|
run: cmake --build build --parallel 10
|
||||||
- name: test
|
- name: Test
|
||||||
run: cd build ; ctest -j 10 -C Debug --output-on-failure
|
run: cd build ; ctest -j 10 -C Debug --output-on-failure
|
||||||
|
|
||||||
msvc2019:
|
msvc2019:
|
||||||
@ -63,15 +63,15 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- name: cmake
|
- name: Run CMake
|
||||||
run: cmake -S . -B build -G "Visual Studio 16 2019" -A ${{ matrix.architecture }} -DJSON_BuildTests=On -DCMAKE_CXX_FLAGS="/W4 /WX"
|
run: cmake -S . -B build -G "Visual Studio 16 2019" -A ${{ matrix.architecture }} -DJSON_BuildTests=On -DCMAKE_CXX_FLAGS="/W4 /WX"
|
||||||
if: matrix.build_type == 'Release'
|
if: matrix.build_type == 'Release'
|
||||||
- name: cmake
|
- name: Run CMake
|
||||||
run: cmake -S . -B build -G "Visual Studio 16 2019" -A ${{ matrix.architecture }} -DJSON_BuildTests=On -DJSON_FastTests=ON -DCMAKE_CXX_FLAGS="/W4 /WX"
|
run: cmake -S . -B build -G "Visual Studio 16 2019" -A ${{ matrix.architecture }} -DJSON_BuildTests=On -DJSON_FastTests=ON -DCMAKE_CXX_FLAGS="/W4 /WX"
|
||||||
if: matrix.build_type == 'Debug'
|
if: matrix.build_type == 'Debug'
|
||||||
- name: build
|
- name: Build
|
||||||
run: cmake --build build --config ${{ matrix.build_type }} --parallel 10
|
run: cmake --build build --config ${{ matrix.build_type }} --parallel 10
|
||||||
- name: test
|
- name: Test
|
||||||
run: cd build ; ctest -j 10 -C ${{ matrix.build_type }} --output-on-failure
|
run: cd build ; ctest -j 10 -C ${{ matrix.build_type }} --output-on-failure
|
||||||
|
|
||||||
msvc2019_latest:
|
msvc2019_latest:
|
||||||
@ -79,11 +79,11 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- name: cmake
|
- name: Run CMake
|
||||||
run: cmake -S . -B build -G "Visual Studio 16 2019" -DJSON_BuildTests=On -DCMAKE_CXX_FLAGS="/permissive- /std:c++latest /utf-8 /W4 /WX"
|
run: cmake -S . -B build -G "Visual Studio 16 2019" -DJSON_BuildTests=On -DCMAKE_CXX_FLAGS="/permissive- /std:c++latest /utf-8 /W4 /WX"
|
||||||
- name: build
|
- name: Build
|
||||||
run: cmake --build build --config Release --parallel 10
|
run: cmake --build build --config Release --parallel 10
|
||||||
- name: test
|
- name: Test
|
||||||
run: cd build ; ctest -j 10 -C Release --output-on-failure
|
run: cd build ; ctest -j 10 -C Release --output-on-failure
|
||||||
|
|
||||||
msvc2022:
|
msvc2022:
|
||||||
@ -95,15 +95,15 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- name: cmake
|
- name: Run CMake
|
||||||
run: cmake -S . -B build -G "Visual Studio 17 2022" -A ${{ matrix.architecture }} -DJSON_BuildTests=On -DCMAKE_CXX_FLAGS="/W4 /WX"
|
run: cmake -S . -B build -G "Visual Studio 17 2022" -A ${{ matrix.architecture }} -DJSON_BuildTests=On -DCMAKE_CXX_FLAGS="/W4 /WX"
|
||||||
if: matrix.build_type == 'Release'
|
if: matrix.build_type == 'Release'
|
||||||
- name: cmake
|
- name: Run CMake
|
||||||
run: cmake -S . -B build -G "Visual Studio 17 2022" -A ${{ matrix.architecture }} -DJSON_BuildTests=On -DJSON_FastTests=ON -DCMAKE_CXX_FLAGS="/W4 /WX"
|
run: cmake -S . -B build -G "Visual Studio 17 2022" -A ${{ matrix.architecture }} -DJSON_BuildTests=On -DJSON_FastTests=ON -DCMAKE_CXX_FLAGS="/W4 /WX"
|
||||||
if: matrix.build_type == 'Debug'
|
if: matrix.build_type == 'Debug'
|
||||||
- name: build
|
- name: Build
|
||||||
run: cmake --build build --config ${{ matrix.build_type }} --parallel 10
|
run: cmake --build build --config ${{ matrix.build_type }} --parallel 10
|
||||||
- name: test
|
- name: Test
|
||||||
run: cd build ; ctest -j 10 -C ${{ matrix.build_type }} --output-on-failure
|
run: cd build ; ctest -j 10 -C ${{ matrix.build_type }} --output-on-failure
|
||||||
|
|
||||||
msvc2022_latest:
|
msvc2022_latest:
|
||||||
@ -111,11 +111,11 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- name: cmake
|
- name: Run CMake
|
||||||
run: cmake -S . -B build -G "Visual Studio 17 2022" -DJSON_BuildTests=On -DCMAKE_CXX_FLAGS="/permissive- /std:c++latest /utf-8 /W4 /WX"
|
run: cmake -S . -B build -G "Visual Studio 17 2022" -DJSON_BuildTests=On -DCMAKE_CXX_FLAGS="/permissive- /std:c++latest /utf-8 /W4 /WX"
|
||||||
- name: build
|
- name: Build
|
||||||
run: cmake --build build --config Release --parallel 10
|
run: cmake --build build --config Release --parallel 10
|
||||||
- name: test
|
- name: Test
|
||||||
run: cd build ; ctest -j 10 -C Release --output-on-failure
|
run: cd build ; ctest -j 10 -C Release --output-on-failure
|
||||||
|
|
||||||
clang:
|
clang:
|
||||||
@ -126,13 +126,13 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- name: install Clang
|
- name: Install Clang
|
||||||
run: curl -fsSL -o LLVM${{ matrix.version }}.exe https://github.com/llvm/llvm-project/releases/download/llvmorg-${{ matrix.version }}.0.0/LLVM-${{ matrix.version }}.0.0-win64.exe ; 7z x LLVM${{ matrix.version }}.exe -y -o"C:/Program Files/LLVM"
|
run: curl -fsSL -o LLVM${{ matrix.version }}.exe https://github.com/llvm/llvm-project/releases/download/llvmorg-${{ matrix.version }}.0.0/LLVM-${{ matrix.version }}.0.0-win64.exe ; 7z x LLVM${{ matrix.version }}.exe -y -o"C:/Program Files/LLVM"
|
||||||
- name: cmake
|
- name: Run CMake
|
||||||
run: cmake -S . -B build -DCMAKE_CXX_COMPILER="C:/Program Files/LLVM/bin/clang++.exe" -G"MinGW Makefiles" -DCMAKE_BUILD_TYPE=Debug -DJSON_BuildTests=On
|
run: cmake -S . -B build -DCMAKE_CXX_COMPILER="C:/Program Files/LLVM/bin/clang++.exe" -G"MinGW Makefiles" -DCMAKE_BUILD_TYPE=Debug -DJSON_BuildTests=On
|
||||||
- name: build
|
- name: Build
|
||||||
run: cmake --build build --parallel 10
|
run: cmake --build build --parallel 10
|
||||||
- name: test
|
- name: Test
|
||||||
run: cd build ; ctest -j 10 -C Debug --exclude-regex "test-unicode" --output-on-failure
|
run: cd build ; ctest -j 10 -C Debug --exclude-regex "test-unicode" --output-on-failure
|
||||||
|
|
||||||
clang-cl-11:
|
clang-cl-11:
|
||||||
@ -143,9 +143,9 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- name: cmake
|
- name: Run CMake
|
||||||
run: cmake -S . -B build -G "Visual Studio 16 2019" -A ${{ matrix.architecture }} -T ClangCL -DJSON_BuildTests=On
|
run: cmake -S . -B build -G "Visual Studio 16 2019" -A ${{ matrix.architecture }} -T ClangCL -DJSON_BuildTests=On
|
||||||
- name: build
|
- name: Build
|
||||||
run: cmake --build build --config Debug --parallel 10
|
run: cmake --build build --config Debug --parallel 10
|
||||||
- name: test
|
- name: Test
|
||||||
run: cd build ; ctest -j 10 -C Debug --exclude-regex "test-unicode" --output-on-failure
|
run: cd build ; ctest -j 10 -C Debug --exclude-regex "test-unicode" --output-on-failure
|
||||||
|
|||||||
4
.lgtm.yml
Normal file
4
.lgtm.yml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
path_classifiers:
|
||||||
|
thirdparty:
|
||||||
|
- /tools/amalgamate
|
||||||
|
- /tools/cpplint
|
||||||
@ -1,6 +1,6 @@
|
|||||||
__ _____ _____ _____
|
__ _____ _____ _____
|
||||||
__| | __| | | | JSON for Modern C++
|
__| | __| | | | JSON for Modern C++
|
||||||
| | |__ | | | | | | version 3.11.1
|
| | |__ | | | | | | version 3.11.2
|
||||||
|_____|_____|_____|_|___| https://github.com/nlohmann/json
|
|_____|_____|_____|_|___| https://github.com/nlohmann/json
|
||||||
|
|
||||||
{% for copyright_line in copyright_lines %}
|
{% for copyright_line in copyright_lines %}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
__ _____ _____ _____
|
__ _____ _____ _____
|
||||||
__| | __| | | | JSON for Modern C++ (supporting code)
|
__| | __| | | | JSON for Modern C++ (supporting code)
|
||||||
| | |__ | | | | | | version 3.11.1
|
| | |__ | | | | | | version 3.11.2
|
||||||
|_____|_____|_____|_|___| https://github.com/nlohmann/json
|
|_____|_____|_____|_|___| https://github.com/nlohmann/json
|
||||||
|
|
||||||
{% for copyright_line in copyright_lines %}
|
{% for copyright_line in copyright_lines %}
|
||||||
|
|||||||
@ -7,8 +7,8 @@ authors:
|
|||||||
email: mail@nlohmann.me
|
email: mail@nlohmann.me
|
||||||
website: https://nlohmann.me
|
website: https://nlohmann.me
|
||||||
title: "JSON for Modern C++"
|
title: "JSON for Modern C++"
|
||||||
version: 3.11.1
|
version: 3.11.2
|
||||||
date-released: 2022-01-03
|
date-released: 2022-08-12
|
||||||
license: MIT
|
license: MIT
|
||||||
repository-code: "https://github.com/nlohmann"
|
repository-code: "https://github.com/nlohmann"
|
||||||
url: https://json.nlohmann.me
|
url: https://json.nlohmann.me
|
||||||
|
|||||||
@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.1)
|
|||||||
## PROJECT
|
## PROJECT
|
||||||
## name and version
|
## name and version
|
||||||
##
|
##
|
||||||
project(nlohmann_json VERSION 3.11.1 LANGUAGES CXX)
|
project(nlohmann_json VERSION 3.11.2 LANGUAGES CXX)
|
||||||
|
|
||||||
##
|
##
|
||||||
## MAIN_PROJECT CHECK
|
## MAIN_PROJECT CHECK
|
||||||
|
|||||||
44
ChangeLog.md
44
ChangeLog.md
@ -1,9 +1,49 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/).
|
All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/).
|
||||||
|
|
||||||
## [3.11.1](https://github.com/nlohmann/json/releases/tag/3.11.1) (2022-08-01)
|
## [3.11.2](https://github.com/nlohmann/json/releases/tag/3.11.2) (2022-08-12)
|
||||||
|
|
||||||
[Full Changelog](https://github.com/nlohmann/json/compare/v3.11.0...3.11.1)
|
[Full Changelog](https://github.com/nlohmann/json/compare/v3.11.1...3.11.2)
|
||||||
|
|
||||||
|
- MSVC natvis visualizer does not work after introduction of inline ABI namespace [\#3696](https://github.com/nlohmann/json/issues/3696)
|
||||||
|
- The use of parenthesis gives compilation errors in some situations [\#3682](https://github.com/nlohmann/json/issues/3682)
|
||||||
|
- extern from/to\_json result in linker error [\#3657](https://github.com/nlohmann/json/issues/3657)
|
||||||
|
- json\_fwd.hpp no longer standalone [\#3656](https://github.com/nlohmann/json/issues/3656)
|
||||||
|
- regression: `.value<size_t>` is compilation error. [\#3655](https://github.com/nlohmann/json/issues/3655)
|
||||||
|
- Regression: no match for 'operator!=' comparing json\_pointer and const char \*/string\_t [\#3654](https://github.com/nlohmann/json/issues/3654)
|
||||||
|
- Regression: call to member function 'value' is ambiguous [\#3652](https://github.com/nlohmann/json/issues/3652)
|
||||||
|
- macOS 10.15 Actions runner image deprecation [\#3612](https://github.com/nlohmann/json/issues/3612)
|
||||||
|
|
||||||
|
- generate\_natvis.py: validate version number; cleanup [\#3698](https://github.com/nlohmann/json/pull/3698) ([falbrechtskirchinger](https://github.com/falbrechtskirchinger))
|
||||||
|
- Add Python script for generating Natvis file and update file for 3.11.2 [\#3697](https://github.com/nlohmann/json/pull/3697) ([falbrechtskirchinger](https://github.com/falbrechtskirchinger))
|
||||||
|
- fix typo in json\_pointer.md [\#3692](https://github.com/nlohmann/json/pull/3692) ([eltociear](https://github.com/eltociear))
|
||||||
|
- Add amalgamated json-fwd.hpp to release [\#3687](https://github.com/nlohmann/json/pull/3687) ([nlohmann](https://github.com/nlohmann))
|
||||||
|
- Documentation updates for 3.11.2 [\#3686](https://github.com/nlohmann/json/pull/3686) ([falbrechtskirchinger](https://github.com/falbrechtskirchinger))
|
||||||
|
- Make json\_pointer usable as map key \(again\) [\#3685](https://github.com/nlohmann/json/pull/3685) ([falbrechtskirchinger](https://github.com/falbrechtskirchinger))
|
||||||
|
- Deprecate json\_pointer/string\_t comparisons [\#3684](https://github.com/nlohmann/json/pull/3684) ([falbrechtskirchinger](https://github.com/falbrechtskirchinger))
|
||||||
|
- Restructure inline namespace and allow version component to be disabled [\#3683](https://github.com/nlohmann/json/pull/3683) ([falbrechtskirchinger](https://github.com/falbrechtskirchinger))
|
||||||
|
- Properly constrain non-string json\_pointer overloads [\#3681](https://github.com/nlohmann/json/pull/3681) ([falbrechtskirchinger](https://github.com/falbrechtskirchinger))
|
||||||
|
- Amalgamate the forward declaration header [\#3679](https://github.com/nlohmann/json/pull/3679) ([falbrechtskirchinger](https://github.com/falbrechtskirchinger))
|
||||||
|
- Fix 'const' qualifier on bool& has no effect [\#3678](https://github.com/nlohmann/json/pull/3678) ([falbrechtskirchinger](https://github.com/falbrechtskirchinger))
|
||||||
|
- Fix whitespace in workflow files [\#3675](https://github.com/nlohmann/json/pull/3675) ([nlohmann](https://github.com/nlohmann))
|
||||||
|
- Attempt to fix labeler permissions [\#3674](https://github.com/nlohmann/json/pull/3674) ([falbrechtskirchinger](https://github.com/falbrechtskirchinger))
|
||||||
|
- Refine 'Publish documentation' workflow [\#3673](https://github.com/nlohmann/json/pull/3673) ([falbrechtskirchinger](https://github.com/falbrechtskirchinger))
|
||||||
|
- Documentation change [\#3672](https://github.com/nlohmann/json/pull/3672) ([nlohmann](https://github.com/nlohmann))
|
||||||
|
- Add labeler action [\#3671](https://github.com/nlohmann/json/pull/3671) ([nlohmann](https://github.com/nlohmann))
|
||||||
|
- Complete contributor list [\#3670](https://github.com/nlohmann/json/pull/3670) ([nlohmann](https://github.com/nlohmann))
|
||||||
|
- Add json\_pointer/string\_t equality comparison operators [\#3664](https://github.com/nlohmann/json/pull/3664) ([falbrechtskirchinger](https://github.com/falbrechtskirchinger))
|
||||||
|
- Reimplement value\(\) access functions [\#3663](https://github.com/nlohmann/json/pull/3663) ([falbrechtskirchinger](https://github.com/falbrechtskirchinger))
|
||||||
|
- Complete contributor list [\#3662](https://github.com/nlohmann/json/pull/3662) ([nlohmann](https://github.com/nlohmann))
|
||||||
|
- Adjust naming of GitHub action jobs [\#3661](https://github.com/nlohmann/json/pull/3661) ([nlohmann](https://github.com/nlohmann))
|
||||||
|
- Publish documentation on push to develop branch [\#3660](https://github.com/nlohmann/json/pull/3660) ([nlohmann](https://github.com/nlohmann))
|
||||||
|
- Add Discord badge to README [\#3651](https://github.com/nlohmann/json/pull/3651) ([falbrechtskirchinger](https://github.com/falbrechtskirchinger))
|
||||||
|
- Miscellaneous small fixes [\#3643](https://github.com/nlohmann/json/pull/3643) ([falbrechtskirchinger](https://github.com/falbrechtskirchinger))
|
||||||
|
- Minor BJData fixes [\#3637](https://github.com/nlohmann/json/pull/3637) ([falbrechtskirchinger](https://github.com/falbrechtskirchinger))
|
||||||
|
- Update CI [\#3626](https://github.com/nlohmann/json/pull/3626) ([falbrechtskirchinger](https://github.com/falbrechtskirchinger))
|
||||||
|
|
||||||
|
## [v3.11.1](https://github.com/nlohmann/json/releases/tag/v3.11.1) (2022-08-01)
|
||||||
|
|
||||||
|
[Full Changelog](https://github.com/nlohmann/json/compare/v3.11.0...v3.11.1)
|
||||||
|
|
||||||
- Regression: no matching literal operator for call to 'operator""\_json' [\#3645](https://github.com/nlohmann/json/issues/3645)
|
- Regression: no matching literal operator for call to 'operator""\_json' [\#3645](https://github.com/nlohmann/json/issues/3645)
|
||||||
- \_json operator""\(\) [\#3644](https://github.com/nlohmann/json/issues/3644)
|
- \_json operator""\(\) [\#3644](https://github.com/nlohmann/json/issues/3644)
|
||||||
|
|||||||
36
Makefile
36
Makefile
@ -18,8 +18,9 @@ SRCS=$(shell find include -type f | sort)
|
|||||||
# the list of sources in the tests folder
|
# the list of sources in the tests folder
|
||||||
TESTS_SRCS=$(shell find tests -type f \( -name '*.hpp' -o -name '*.cpp' -o -name '*.cu' \) -not -path 'tests/thirdparty/*' -not -path 'tests/abi/include/nlohmann/*' | sort)
|
TESTS_SRCS=$(shell find tests -type f \( -name '*.hpp' -o -name '*.cpp' -o -name '*.cu' \) -not -path 'tests/thirdparty/*' -not -path 'tests/abi/include/nlohmann/*' | sort)
|
||||||
|
|
||||||
# the single header (amalgamated from the source files)
|
# the single headers (amalgamated from the source files)
|
||||||
AMALGAMATED_FILE=single_include/nlohmann/json.hpp
|
AMALGAMATED_FILE=single_include/nlohmann/json.hpp
|
||||||
|
AMALGAMATED_FWD_FILE=single_include/nlohmann/json_fwd.hpp
|
||||||
|
|
||||||
|
|
||||||
##########################################################################
|
##########################################################################
|
||||||
@ -28,7 +29,7 @@ AMALGAMATED_FILE=single_include/nlohmann/json.hpp
|
|||||||
|
|
||||||
# main target
|
# main target
|
||||||
all:
|
all:
|
||||||
@echo "amalgamate - amalgamate file single_include/nlohmann/json.hpp from the include/nlohmann sources"
|
@echo "amalgamate - amalgamate files single_include/nlohmann/json{,_fwd}.hpp from the include/nlohmann sources"
|
||||||
@echo "ChangeLog.md - generate ChangeLog file"
|
@echo "ChangeLog.md - generate ChangeLog file"
|
||||||
@echo "check-amalgamation - check whether sources have been amalgamated"
|
@echo "check-amalgamation - check whether sources have been amalgamated"
|
||||||
@echo "clean - remove built files"
|
@echo "clean - remove built files"
|
||||||
@ -144,9 +145,9 @@ pvs_studio:
|
|||||||
# call the Artistic Style pretty printer on all source files
|
# call the Artistic Style pretty printer on all source files
|
||||||
pretty:
|
pretty:
|
||||||
astyle \
|
astyle \
|
||||||
--style=allman \
|
--style=allman \
|
||||||
--indent=spaces=4 \
|
--indent=spaces=4 \
|
||||||
--indent-modifiers \
|
--indent-modifiers \
|
||||||
--indent-switches \
|
--indent-switches \
|
||||||
--indent-preproc-block \
|
--indent-preproc-block \
|
||||||
--indent-preproc-define \
|
--indent-preproc-define \
|
||||||
@ -162,27 +163,34 @@ pretty:
|
|||||||
--preserve-date \
|
--preserve-date \
|
||||||
--suffix=none \
|
--suffix=none \
|
||||||
--formatted \
|
--formatted \
|
||||||
$(SRCS) $(TESTS_SRCS) $(AMALGAMATED_FILE) docs/examples/*.cpp
|
$(SRCS) $(TESTS_SRCS) $(AMALGAMATED_FILE) $(AMALGAMATED_FWD_FILE) docs/examples/*.cpp
|
||||||
|
|
||||||
# call the Clang-Format on all source files
|
# call the Clang-Format on all source files
|
||||||
pretty_format:
|
pretty_format:
|
||||||
for FILE in $(SRCS) $(TESTS_SRCS) $(AMALGAMATED_FILE) docs/examples/*.cpp; do echo $$FILE; clang-format -i $$FILE; done
|
for FILE in $(SRCS) $(TESTS_SRCS) $(AMALGAMATED_FILE) docs/examples/*.cpp; do echo $$FILE; clang-format -i $$FILE; done
|
||||||
|
|
||||||
# create single header file
|
# create single header files and pretty print
|
||||||
amalgamate: $(AMALGAMATED_FILE)
|
amalgamate: $(AMALGAMATED_FILE) $(AMALGAMATED_FWD_FILE)
|
||||||
|
|
||||||
# call the amalgamation tool and pretty print
|
|
||||||
$(AMALGAMATED_FILE): $(SRCS)
|
|
||||||
tools/amalgamate/amalgamate.py -c tools/amalgamate/config.json -s . --verbose=yes
|
|
||||||
$(MAKE) pretty
|
$(MAKE) pretty
|
||||||
|
|
||||||
|
# call the amalgamation tool for json.hpp
|
||||||
|
$(AMALGAMATED_FILE): $(SRCS)
|
||||||
|
tools/amalgamate/amalgamate.py -c tools/amalgamate/config_json.json -s . --verbose=yes
|
||||||
|
|
||||||
|
# call the amalgamation tool for json_fwd.hpp
|
||||||
|
$(AMALGAMATED_FWD_FILE): $(SRCS)
|
||||||
|
tools/amalgamate/amalgamate.py -c tools/amalgamate/config_json_fwd.json -s . --verbose=yes
|
||||||
|
|
||||||
# check if file single_include/nlohmann/json.hpp has been amalgamated from the nlohmann sources
|
# check if file single_include/nlohmann/json.hpp has been amalgamated from the nlohmann sources
|
||||||
# Note: this target is called by Travis
|
# Note: this target is called by Travis
|
||||||
check-amalgamation:
|
check-amalgamation:
|
||||||
@mv $(AMALGAMATED_FILE) $(AMALGAMATED_FILE)~
|
@mv $(AMALGAMATED_FILE) $(AMALGAMATED_FILE)~
|
||||||
|
@mv $(AMALGAMATED_FWD_FILE) $(AMALGAMATED_FWD_FILE)~
|
||||||
@$(MAKE) amalgamate
|
@$(MAKE) amalgamate
|
||||||
@diff $(AMALGAMATED_FILE) $(AMALGAMATED_FILE)~ || (echo "===================================================================\n Amalgamation required! Please read the contribution guidelines\n in file .github/CONTRIBUTING.md.\n===================================================================" ; mv $(AMALGAMATED_FILE)~ $(AMALGAMATED_FILE) ; false)
|
@diff $(AMALGAMATED_FILE) $(AMALGAMATED_FILE)~ || (echo "===================================================================\n Amalgamation required! Please read the contribution guidelines\n in file .github/CONTRIBUTING.md.\n===================================================================" ; mv $(AMALGAMATED_FILE)~ $(AMALGAMATED_FILE) ; false)
|
||||||
|
@diff $(AMALGAMATED_FWD_FILE) $(AMALGAMATED_FWD_FILE)~ || (echo "===================================================================\n Amalgamation required! Please read the contribution guidelines\n in file .github/CONTRIBUTING.md.\n===================================================================" ; mv $(AMALGAMATED_FWD_FILE)~ $(AMALGAMATED_FWD_FILE) ; false)
|
||||||
@mv $(AMALGAMATED_FILE)~ $(AMALGAMATED_FILE)
|
@mv $(AMALGAMATED_FILE)~ $(AMALGAMATED_FILE)
|
||||||
|
@mv $(AMALGAMATED_FWD_FILE)~ $(AMALGAMATED_FWD_FILE)
|
||||||
|
|
||||||
|
|
||||||
##########################################################################
|
##########################################################################
|
||||||
@ -224,9 +232,11 @@ release: include.zip json.tar.xz
|
|||||||
mkdir release_files
|
mkdir release_files
|
||||||
gpg --armor --detach-sig include.zip
|
gpg --armor --detach-sig include.zip
|
||||||
gpg --armor --detach-sig $(AMALGAMATED_FILE)
|
gpg --armor --detach-sig $(AMALGAMATED_FILE)
|
||||||
|
gpg --armor --detach-sig $(AMALGAMATED_FWD_FILE)
|
||||||
gpg --armor --detach-sig json.tar.xz
|
gpg --armor --detach-sig json.tar.xz
|
||||||
cp $(AMALGAMATED_FILE) release_files
|
cp $(AMALGAMATED_FILE) release_files
|
||||||
mv $(AMALGAMATED_FILE).asc json.tar.xz json.tar.xz.asc include.zip include.zip.asc release_files
|
cp $(AMALGAMATED_FWD_FILE) release_files
|
||||||
|
mv $(AMALGAMATED_FILE).asc $(AMALGAMATED_FWD_FILE).asc json.tar.xz json.tar.xz.asc include.zip include.zip.asc release_files
|
||||||
cd release_files ; shasum -a 256 json.hpp include.zip json.tar.xz > hashes.txt
|
cd release_files ; shasum -a 256 json.hpp include.zip json.tar.xz > hashes.txt
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
627
README.md
627
README.md
@ -20,6 +20,7 @@
|
|||||||
[](https://bestpractices.coreinfrastructure.org/projects/289)
|
[](https://bestpractices.coreinfrastructure.org/projects/289)
|
||||||
[](https://github.com/sponsors/nlohmann)
|
[](https://github.com/sponsors/nlohmann)
|
||||||
[](https://api.reuse.software/info/github.com/nlohmann/json)
|
[](https://api.reuse.software/info/github.com/nlohmann/json)
|
||||||
|
[](https://discord.gg/6mrGXKvX7y)
|
||||||
|
|
||||||
- [Design goals](#design-goals)
|
- [Design goals](#design-goals)
|
||||||
- [Sponsors](#sponsors)
|
- [Sponsors](#sponsors)
|
||||||
@ -1143,24 +1144,14 @@ The following compilers are currently used in continuous integration at [AppVeyo
|
|||||||
|
|
||||||
| Compiler | Operating System | CI Provider |
|
| Compiler | Operating System | CI Provider |
|
||||||
|--------------------------------------------------------------------------------------------------------|--------------------|----------------|
|
|--------------------------------------------------------------------------------------------------------|--------------------|----------------|
|
||||||
| Apple Clang 10.0.1 (clang-1001.0.46.4); Xcode 10.3 | macOS 10.15.7 | GitHub Actions |
|
| Apple Clang 11.0.3 (clang-1103.0.32.62); Xcode 11.7 | macOS 11.6.8 | GitHub Actions |
|
||||||
| Apple Clang 11.0.0 (clang-1100.0.33.12); Xcode 11.2.1 | macOS 10.15.7 | GitHub Actions |
|
| Apple Clang 12.0.0 (clang-1200.0.32.29); Xcode 12.4 | macOS 11.6.8 | GitHub Actions |
|
||||||
| Apple Clang 11.0.0 (clang-1100.0.33.17); Xcode 11.3.1 | macOS 10.15.7 | GitHub Actions |
|
| Apple Clang 12.0.5 (clang-1205.0.22.11); Xcode 12.5.1 | macOS 11.6.8 | GitHub Actions |
|
||||||
| Apple Clang 11.0.3 (clang-1103.0.32.59); Xcode 11.4.1 | macOS 10.15.7 | GitHub Actions |
|
| Apple Clang 13.0.0 (clang-1300.0.29.3); Xcode 13.0 | macOS 11.6.8 | GitHub Actions |
|
||||||
| Apple Clang 11.0.3 (clang-1103.0.32.62); Xcode 11.5 | macOS 10.15.7 | GitHub Actions |
|
| Apple Clang 13.0.0 (clang-1300.0.29.3); Xcode 13.1 | macOS 12.4 | GitHub Actions |
|
||||||
| Apple Clang 11.0.3 (clang-1103.0.32.62); Xcode 11.6 | macOS 10.15.7 | GitHub Actions |
|
| Apple Clang 13.0.0 (clang-1300.0.29.30); Xcode 13.2.1 | macOS 12.4 | GitHub Actions |
|
||||||
| Apple Clang 11.0.3 (clang-1103.0.32.62); Xcode 11.7 | macOS 10.15.7 | GitHub Actions |
|
| Apple Clang 13.1.6 (clang-1316.0.21.2.3); Xcode 13.3.1 | macOS 12.4 | GitHub Actions |
|
||||||
| Apple Clang 12.0.0 (clang-1200.0.32.2); Xcode 12 | macOS 10.15.7 | GitHub Actions |
|
| Apple Clang 13.1.6 (clang-1316.0.21.2.5); Xcode 13.4.1 | macOS 12.4 | GitHub Actions |
|
||||||
| Apple Clang 12.0.0 (clang-1200.0.32.21); Xcode 12.1 | macOS 10.15.7 | GitHub Actions |
|
|
||||||
| Apple Clang 12.0.0 (clang-1200.0.32.21); Xcode 12.1.1 | macOS 10.15.7 | GitHub Actions |
|
|
||||||
| Apple Clang 12.0.0 (clang-1200.0.32.27); Xcode 12.2 | macOS 10.15.7 | GitHub Actions |
|
|
||||||
| Apple Clang 12.0.0 (clang-1200.0.32.28); Xcode 12.3 | macOS 10.15.7 | GitHub Actions |
|
|
||||||
| Apple Clang 12.0.0 (clang-1200.0.32.29); Xcode 12.4 | macOS 10.15.7 | GitHub Actions |
|
|
||||||
| Apple Clang 13.0.0 (clang-1300.0.29.3); Xcode 13.1 | macOS 12.3.1 | GitHub Actions |
|
|
||||||
| Apple Clang 13.0.0 (clang-1300.0.29.30); Xcode 13.2 | macOS 12.3.1 | GitHub Actions |
|
|
||||||
| Apple Clang 13.0.0 (clang-1300.0.29.30); Xcode 13.2.1 | macOS 12.3.1 | GitHub Actions |
|
|
||||||
| Apple Clang 13.1.6 (clang-1316.0.21.2); Xcode 13.3 | macOS 12.3.1 | GitHub Actions |
|
|
||||||
| Apple Clang 13.1.6 (clang-1316.0.21.2.3); Xcode 13.3.1 | macOS 12.3.1 | GitHub Actions |
|
|
||||||
| Clang 3.5.2 (3.5.2-3ubuntu1) | Ubuntu 20.04.3 LTS | GitHub Actions |
|
| Clang 3.5.2 (3.5.2-3ubuntu1) | Ubuntu 20.04.3 LTS | GitHub Actions |
|
||||||
| Clang 3.6.2 (3.6.2-3ubuntu2) | Ubuntu 20.04.3 LTS | GitHub Actions |
|
| Clang 3.6.2 (3.6.2-3ubuntu2) | Ubuntu 20.04.3 LTS | GitHub Actions |
|
||||||
| Clang 3.7.1 (3.7.1-2ubuntu2) | Ubuntu 20.04.3 LTS | GitHub Actions |
|
| Clang 3.7.1 (3.7.1-2ubuntu2) | Ubuntu 20.04.3 LTS | GitHub Actions |
|
||||||
@ -1271,7 +1262,7 @@ Example:
|
|||||||
```cmake
|
```cmake
|
||||||
include(FetchContent)
|
include(FetchContent)
|
||||||
|
|
||||||
FetchContent_Declare(json URL https://github.com/nlohmann/json/releases/download/v3.11.1/json.tar.xz)
|
FetchContent_Declare(json URL https://github.com/nlohmann/json/releases/download/v3.11.2/json.tar.xz)
|
||||||
FetchContent_MakeAvailable(json)
|
FetchContent_MakeAvailable(json)
|
||||||
|
|
||||||
target_link_libraries(foo PRIVATE nlohmann_json::nlohmann_json)
|
target_link_libraries(foo PRIVATE nlohmann_json::nlohmann_json)
|
||||||
@ -1411,288 +1402,322 @@ I deeply appreciate the help of the following people.
|
|||||||
|
|
||||||
<img src="https://raw.githubusercontent.com/nlohmann/json/develop/docs/avatars.png" align="right">
|
<img src="https://raw.githubusercontent.com/nlohmann/json/develop/docs/avatars.png" align="right">
|
||||||
|
|
||||||
- [Teemperor](https://github.com/Teemperor) implemented CMake support and lcov integration, realized escape and Unicode handling in the string parser, and fixed the JSON serialization.
|
1. [Teemperor](https://github.com/Teemperor) implemented CMake support and lcov integration, realized escape and Unicode handling in the string parser, and fixed the JSON serialization.
|
||||||
- [elliotgoodrich](https://github.com/elliotgoodrich) fixed an issue with double deletion in the iterator classes.
|
2. [elliotgoodrich](https://github.com/elliotgoodrich) fixed an issue with double deletion in the iterator classes.
|
||||||
- [kirkshoop](https://github.com/kirkshoop) made the iterators of the class composable to other libraries.
|
3. [kirkshoop](https://github.com/kirkshoop) made the iterators of the class composable to other libraries.
|
||||||
- [wancw](https://github.com/wanwc) fixed a bug that hindered the class to compile with Clang.
|
4. [wancw](https://github.com/wanwc) fixed a bug that hindered the class to compile with Clang.
|
||||||
- Tomas Åblad found a bug in the iterator implementation.
|
5. Tomas Åblad found a bug in the iterator implementation.
|
||||||
- [Joshua C. Randall](https://github.com/jrandall) fixed a bug in the floating-point serialization.
|
6. [Joshua C. Randall](https://github.com/jrandall) fixed a bug in the floating-point serialization.
|
||||||
- [Aaron Burghardt](https://github.com/aburgh) implemented code to parse streams incrementally. Furthermore, he greatly improved the parser class by allowing the definition of a filter function to discard undesired elements while parsing.
|
7. [Aaron Burghardt](https://github.com/aburgh) implemented code to parse streams incrementally. Furthermore, he greatly improved the parser class by allowing the definition of a filter function to discard undesired elements while parsing.
|
||||||
- [Daniel Kopeček](https://github.com/dkopecek) fixed a bug in the compilation with GCC 5.0.
|
8. [Daniel Kopeček](https://github.com/dkopecek) fixed a bug in the compilation with GCC 5.0.
|
||||||
- [Florian Weber](https://github.com/Florianjw) fixed a bug in and improved the performance of the comparison operators.
|
9. [Florian Weber](https://github.com/Florianjw) fixed a bug in and improved the performance of the comparison operators.
|
||||||
- [Eric Cornelius](https://github.com/EricMCornelius) pointed out a bug in the handling with NaN and infinity values. He also improved the performance of the string escaping.
|
10. [Eric Cornelius](https://github.com/EricMCornelius) pointed out a bug in the handling with NaN and infinity values. He also improved the performance of the string escaping.
|
||||||
- [易思龙](https://github.com/likebeta) implemented a conversion from anonymous enums.
|
11. [易思龙](https://github.com/likebeta) implemented a conversion from anonymous enums.
|
||||||
- [kepkin](https://github.com/kepkin) patiently pushed forward the support for Microsoft Visual studio.
|
12. [kepkin](https://github.com/kepkin) patiently pushed forward the support for Microsoft Visual studio.
|
||||||
- [gregmarr](https://github.com/gregmarr) simplified the implementation of reverse iterators and helped with numerous hints and improvements. In particular, he pushed forward the implementation of user-defined types.
|
13. [gregmarr](https://github.com/gregmarr) simplified the implementation of reverse iterators and helped with numerous hints and improvements. In particular, he pushed forward the implementation of user-defined types.
|
||||||
- [Caio Luppi](https://github.com/caiovlp) fixed a bug in the Unicode handling.
|
14. [Caio Luppi](https://github.com/caiovlp) fixed a bug in the Unicode handling.
|
||||||
- [dariomt](https://github.com/dariomt) fixed some typos in the examples.
|
15. [dariomt](https://github.com/dariomt) fixed some typos in the examples.
|
||||||
- [Daniel Frey](https://github.com/d-frey) cleaned up some pointers and implemented exception-safe memory allocation.
|
16. [Daniel Frey](https://github.com/d-frey) cleaned up some pointers and implemented exception-safe memory allocation.
|
||||||
- [Colin Hirsch](https://github.com/ColinH) took care of a small namespace issue.
|
17. [Colin Hirsch](https://github.com/ColinH) took care of a small namespace issue.
|
||||||
- [Huu Nguyen](https://github.com/whoshuu) correct a variable name in the documentation.
|
18. [Huu Nguyen](https://github.com/whoshuu) correct a variable name in the documentation.
|
||||||
- [Silverweed](https://github.com/silverweed) overloaded `parse()` to accept an rvalue reference.
|
19. [Silverweed](https://github.com/silverweed) overloaded `parse()` to accept an rvalue reference.
|
||||||
- [dariomt](https://github.com/dariomt) fixed a subtlety in MSVC type support and implemented the `get_ref()` function to get a reference to stored values.
|
20. [dariomt](https://github.com/dariomt) fixed a subtlety in MSVC type support and implemented the `get_ref()` function to get a reference to stored values.
|
||||||
- [ZahlGraf](https://github.com/ZahlGraf) added a workaround that allows compilation using Android NDK.
|
21. [ZahlGraf](https://github.com/ZahlGraf) added a workaround that allows compilation using Android NDK.
|
||||||
- [whackashoe](https://github.com/whackashoe) replaced a function that was marked as unsafe by Visual Studio.
|
22. [whackashoe](https://github.com/whackashoe) replaced a function that was marked as unsafe by Visual Studio.
|
||||||
- [406345](https://github.com/406345) fixed two small warnings.
|
23. [406345](https://github.com/406345) fixed two small warnings.
|
||||||
- [Glen Fernandes](https://github.com/glenfe) noted a potential portability problem in the `has_mapped_type` function.
|
24. [Glen Fernandes](https://github.com/glenfe) noted a potential portability problem in the `has_mapped_type` function.
|
||||||
- [Corbin Hughes](https://github.com/nibroc) fixed some typos in the contribution guidelines.
|
25. [Corbin Hughes](https://github.com/nibroc) fixed some typos in the contribution guidelines.
|
||||||
- [twelsby](https://github.com/twelsby) fixed the array subscript operator, an issue that failed the MSVC build, and floating-point parsing/dumping. He further added support for unsigned integer numbers and implemented better roundtrip support for parsed numbers.
|
26. [twelsby](https://github.com/twelsby) fixed the array subscript operator, an issue that failed the MSVC build, and floating-point parsing/dumping. He further added support for unsigned integer numbers and implemented better roundtrip support for parsed numbers.
|
||||||
- [Volker Diels-Grabsch](https://github.com/vog) fixed a link in the README file.
|
27. [Volker Diels-Grabsch](https://github.com/vog) fixed a link in the README file.
|
||||||
- [msm-](https://github.com/msm-) added support for American Fuzzy Lop.
|
28. [msm-](https://github.com/msm-) added support for American Fuzzy Lop.
|
||||||
- [Annihil](https://github.com/Annihil) fixed an example in the README file.
|
29. [Annihil](https://github.com/Annihil) fixed an example in the README file.
|
||||||
- [Themercee](https://github.com/Themercee) noted a wrong URL in the README file.
|
30. [Themercee](https://github.com/Themercee) noted a wrong URL in the README file.
|
||||||
- [Lv Zheng](https://github.com/lv-zheng) fixed a namespace issue with `int64_t` and `uint64_t`.
|
31. [Lv Zheng](https://github.com/lv-zheng) fixed a namespace issue with `int64_t` and `uint64_t`.
|
||||||
- [abc100m](https://github.com/abc100m) analyzed the issues with GCC 4.8 and proposed a [partial solution](https://github.com/nlohmann/json/pull/212).
|
32. [abc100m](https://github.com/abc100m) analyzed the issues with GCC 4.8 and proposed a [partial solution](https://github.com/nlohmann/json/pull/212).
|
||||||
- [zewt](https://github.com/zewt) added useful notes to the README file about Android.
|
33. [zewt](https://github.com/zewt) added useful notes to the README file about Android.
|
||||||
- [Róbert Márki](https://github.com/robertmrk) added a fix to use move iterators and improved the integration via CMake.
|
34. [Róbert Márki](https://github.com/robertmrk) added a fix to use move iterators and improved the integration via CMake.
|
||||||
- [Chris Kitching](https://github.com/ChrisKitching) cleaned up the CMake files.
|
35. [Chris Kitching](https://github.com/ChrisKitching) cleaned up the CMake files.
|
||||||
- [Tom Needham](https://github.com/06needhamt) fixed a subtle bug with MSVC 2015 which was also proposed by [Michael K.](https://github.com/Epidal).
|
36. [Tom Needham](https://github.com/06needhamt) fixed a subtle bug with MSVC 2015 which was also proposed by [Michael K.](https://github.com/Epidal).
|
||||||
- [Mário Feroldi](https://github.com/thelostt) fixed a small typo.
|
37. [Mário Feroldi](https://github.com/thelostt) fixed a small typo.
|
||||||
- [duncanwerner](https://github.com/duncanwerner) found a really embarrassing performance regression in the 2.0.0 release.
|
38. [duncanwerner](https://github.com/duncanwerner) found a really embarrassing performance regression in the 2.0.0 release.
|
||||||
- [Damien](https://github.com/dtoma) fixed one of the last conversion warnings.
|
39. [Damien](https://github.com/dtoma) fixed one of the last conversion warnings.
|
||||||
- [Thomas Braun](https://github.com/t-b) fixed a warning in a test case and adjusted MSVC calls in the CI.
|
40. [Thomas Braun](https://github.com/t-b) fixed a warning in a test case and adjusted MSVC calls in the CI.
|
||||||
- [Théo DELRIEU](https://github.com/theodelrieu) patiently and constructively oversaw the long way toward [iterator-range parsing](https://github.com/nlohmann/json/issues/290). He also implemented the magic behind the serialization/deserialization of user-defined types and split the single header file into smaller chunks.
|
41. [Théo DELRIEU](https://github.com/theodelrieu) patiently and constructively oversaw the long way toward [iterator-range parsing](https://github.com/nlohmann/json/issues/290). He also implemented the magic behind the serialization/deserialization of user-defined types and split the single header file into smaller chunks.
|
||||||
- [Stefan](https://github.com/5tefan) fixed a minor issue in the documentation.
|
42. [Stefan](https://github.com/5tefan) fixed a minor issue in the documentation.
|
||||||
- [Vasil Dimov](https://github.com/vasild) fixed the documentation regarding conversions from `std::multiset`.
|
43. [Vasil Dimov](https://github.com/vasild) fixed the documentation regarding conversions from `std::multiset`.
|
||||||
- [ChristophJud](https://github.com/ChristophJud) overworked the CMake files to ease project inclusion.
|
44. [ChristophJud](https://github.com/ChristophJud) overworked the CMake files to ease project inclusion.
|
||||||
- [Vladimir Petrigo](https://github.com/vpetrigo) made a SFINAE hack more readable and added Visual Studio 17 to the build matrix.
|
45. [Vladimir Petrigo](https://github.com/vpetrigo) made a SFINAE hack more readable and added Visual Studio 17 to the build matrix.
|
||||||
- [Denis Andrejew](https://github.com/seeekr) fixed a grammar issue in the README file.
|
46. [Denis Andrejew](https://github.com/seeekr) fixed a grammar issue in the README file.
|
||||||
- [Pierre-Antoine Lacaze](https://github.com/palacaze) found a subtle bug in the `dump()` function.
|
47. [Pierre-Antoine Lacaze](https://github.com/palacaze) found a subtle bug in the `dump()` function.
|
||||||
- [TurpentineDistillery](https://github.com/TurpentineDistillery) pointed to [`std::locale::classic()`](https://en.cppreference.com/w/cpp/locale/locale/classic) to avoid too much locale joggling, found some nice performance improvements in the parser, improved the benchmarking code, and realized locale-independent number parsing and printing.
|
48. [TurpentineDistillery](https://github.com/TurpentineDistillery) pointed to [`std::locale::classic()`](https://en.cppreference.com/w/cpp/locale/locale/classic) to avoid too much locale joggling, found some nice performance improvements in the parser, improved the benchmarking code, and realized locale-independent number parsing and printing.
|
||||||
- [cgzones](https://github.com/cgzones) had an idea how to fix the Coverity scan.
|
49. [cgzones](https://github.com/cgzones) had an idea how to fix the Coverity scan.
|
||||||
- [Jared Grubb](https://github.com/jaredgrubb) silenced a nasty documentation warning.
|
50. [Jared Grubb](https://github.com/jaredgrubb) silenced a nasty documentation warning.
|
||||||
- [Yixin Zhang](https://github.com/qwename) fixed an integer overflow check.
|
51. [Yixin Zhang](https://github.com/qwename) fixed an integer overflow check.
|
||||||
- [Bosswestfalen](https://github.com/Bosswestfalen) merged two iterator classes into a smaller one.
|
52. [Bosswestfalen](https://github.com/Bosswestfalen) merged two iterator classes into a smaller one.
|
||||||
- [Daniel599](https://github.com/Daniel599) helped to get Travis execute the tests with Clang's sanitizers.
|
53. [Daniel599](https://github.com/Daniel599) helped to get Travis execute the tests with Clang's sanitizers.
|
||||||
- [Jonathan Lee](https://github.com/vjon) fixed an example in the README file.
|
54. [Jonathan Lee](https://github.com/vjon) fixed an example in the README file.
|
||||||
- [gnzlbg](https://github.com/gnzlbg) supported the implementation of user-defined types.
|
55. [gnzlbg](https://github.com/gnzlbg) supported the implementation of user-defined types.
|
||||||
- [Alexej Harm](https://github.com/qis) helped to get the user-defined types working with Visual Studio.
|
56. [Alexej Harm](https://github.com/qis) helped to get the user-defined types working with Visual Studio.
|
||||||
- [Jared Grubb](https://github.com/jaredgrubb) supported the implementation of user-defined types.
|
57. [Jared Grubb](https://github.com/jaredgrubb) supported the implementation of user-defined types.
|
||||||
- [EnricoBilla](https://github.com/EnricoBilla) noted a typo in an example.
|
58. [EnricoBilla](https://github.com/EnricoBilla) noted a typo in an example.
|
||||||
- [Martin Hořeňovský](https://github.com/horenmar) found a way for a 2x speedup for the compilation time of the test suite.
|
59. [Martin Hořeňovský](https://github.com/horenmar) found a way for a 2x speedup for the compilation time of the test suite.
|
||||||
- [ukhegg](https://github.com/ukhegg) found proposed an improvement for the examples section.
|
60. [ukhegg](https://github.com/ukhegg) found proposed an improvement for the examples section.
|
||||||
- [rswanson-ihi](https://github.com/rswanson-ihi) noted a typo in the README.
|
61. [rswanson-ihi](https://github.com/rswanson-ihi) noted a typo in the README.
|
||||||
- [Mihai Stan](https://github.com/stanmihai4) fixed a bug in the comparison with `nullptr`s.
|
62. [Mihai Stan](https://github.com/stanmihai4) fixed a bug in the comparison with `nullptr`s.
|
||||||
- [Tushar Maheshwari](https://github.com/tusharpm) added [cotire](https://github.com/sakra/cotire) support to speed up the compilation.
|
63. [Tushar Maheshwari](https://github.com/tusharpm) added [cotire](https://github.com/sakra/cotire) support to speed up the compilation.
|
||||||
- [TedLyngmo](https://github.com/TedLyngmo) noted a typo in the README, removed unnecessary bit arithmetic, and fixed some `-Weffc++` warnings.
|
64. [TedLyngmo](https://github.com/TedLyngmo) noted a typo in the README, removed unnecessary bit arithmetic, and fixed some `-Weffc++` warnings.
|
||||||
- [Krzysztof Woś](https://github.com/krzysztofwos) made exceptions more visible.
|
65. [Krzysztof Woś](https://github.com/krzysztofwos) made exceptions more visible.
|
||||||
- [ftillier](https://github.com/ftillier) fixed a compiler warning.
|
66. [ftillier](https://github.com/ftillier) fixed a compiler warning.
|
||||||
- [tinloaf](https://github.com/tinloaf) made sure all pushed warnings are properly popped.
|
67. [tinloaf](https://github.com/tinloaf) made sure all pushed warnings are properly popped.
|
||||||
- [Fytch](https://github.com/Fytch) found a bug in the documentation.
|
68. [Fytch](https://github.com/Fytch) found a bug in the documentation.
|
||||||
- [Jay Sistar](https://github.com/Type1J) implemented a Meson build description.
|
69. [Jay Sistar](https://github.com/Type1J) implemented a Meson build description.
|
||||||
- [Henry Lee](https://github.com/HenryRLee) fixed a warning in ICC and improved the iterator implementation.
|
70. [Henry Lee](https://github.com/HenryRLee) fixed a warning in ICC and improved the iterator implementation.
|
||||||
- [Vincent Thiery](https://github.com/vthiery) maintains a package for the Conan package manager.
|
71. [Vincent Thiery](https://github.com/vthiery) maintains a package for the Conan package manager.
|
||||||
- [Steffen](https://github.com/koemeet) fixed a potential issue with MSVC and `std::min`.
|
72. [Steffen](https://github.com/koemeet) fixed a potential issue with MSVC and `std::min`.
|
||||||
- [Mike Tzou](https://github.com/Chocobo1) fixed some typos.
|
73. [Mike Tzou](https://github.com/Chocobo1) fixed some typos.
|
||||||
- [amrcode](https://github.com/amrcode) noted a misleading documentation about comparison of floats.
|
74. [amrcode](https://github.com/amrcode) noted a misleading documentation about comparison of floats.
|
||||||
- [Oleg Endo](https://github.com/olegendo) reduced the memory consumption by replacing `<iostream>` with `<iosfwd>`.
|
75. [Oleg Endo](https://github.com/olegendo) reduced the memory consumption by replacing `<iostream>` with `<iosfwd>`.
|
||||||
- [dan-42](https://github.com/dan-42) cleaned up the CMake files to simplify including/reusing of the library.
|
76. [dan-42](https://github.com/dan-42) cleaned up the CMake files to simplify including/reusing of the library.
|
||||||
- [Nikita Ofitserov](https://github.com/himikof) allowed for moving values from initializer lists.
|
77. [Nikita Ofitserov](https://github.com/himikof) allowed for moving values from initializer lists.
|
||||||
- [Greg Hurrell](https://github.com/wincent) fixed a typo.
|
78. [Greg Hurrell](https://github.com/wincent) fixed a typo.
|
||||||
- [Dmitry Kukovinets](https://github.com/DmitryKuk) fixed a typo.
|
79. [Dmitry Kukovinets](https://github.com/DmitryKuk) fixed a typo.
|
||||||
- [kbthomp1](https://github.com/kbthomp1) fixed an issue related to the Intel OSX compiler.
|
80. [kbthomp1](https://github.com/kbthomp1) fixed an issue related to the Intel OSX compiler.
|
||||||
- [Markus Werle](https://github.com/daixtrose) fixed a typo.
|
81. [Markus Werle](https://github.com/daixtrose) fixed a typo.
|
||||||
- [WebProdPP](https://github.com/WebProdPP) fixed a subtle error in a precondition check.
|
82. [WebProdPP](https://github.com/WebProdPP) fixed a subtle error in a precondition check.
|
||||||
- [Alex](https://github.com/leha-bot) noted an error in a code sample.
|
83. [Alex](https://github.com/leha-bot) noted an error in a code sample.
|
||||||
- [Tom de Geus](https://github.com/tdegeus) reported some warnings with ICC and helped to fix them.
|
84. [Tom de Geus](https://github.com/tdegeus) reported some warnings with ICC and helped to fix them.
|
||||||
- [Perry Kundert](https://github.com/pjkundert) simplified reading from input streams.
|
85. [Perry Kundert](https://github.com/pjkundert) simplified reading from input streams.
|
||||||
- [Sonu Lohani](https://github.com/sonulohani) fixed a small compilation error.
|
86. [Sonu Lohani](https://github.com/sonulohani) fixed a small compilation error.
|
||||||
- [Jamie Seward](https://github.com/jseward) fixed all MSVC warnings.
|
87. [Jamie Seward](https://github.com/jseward) fixed all MSVC warnings.
|
||||||
- [Nate Vargas](https://github.com/eld00d) added a Doxygen tag file.
|
88. [Nate Vargas](https://github.com/eld00d) added a Doxygen tag file.
|
||||||
- [pvleuven](https://github.com/pvleuven) helped to fix a warning in ICC.
|
89. [pvleuven](https://github.com/pvleuven) helped to fix a warning in ICC.
|
||||||
- [Pavel](https://github.com/crea7or) helped to fix some warnings in MSVC.
|
90. [Pavel](https://github.com/crea7or) helped to fix some warnings in MSVC.
|
||||||
- [Jamie Seward](https://github.com/jseward) avoided unnecessary string copies in `find()` and `count()`.
|
91. [Jamie Seward](https://github.com/jseward) avoided unnecessary string copies in `find()` and `count()`.
|
||||||
- [Mitja](https://github.com/Itja) fixed some typos.
|
92. [Mitja](https://github.com/Itja) fixed some typos.
|
||||||
- [Jorrit Wronski](https://github.com/jowr) updated the Hunter package links.
|
93. [Jorrit Wronski](https://github.com/jowr) updated the Hunter package links.
|
||||||
- [Matthias Möller](https://github.com/TinyTinni) added a `.natvis` for the MSVC debug view.
|
94. [Matthias Möller](https://github.com/TinyTinni) added a `.natvis` for the MSVC debug view.
|
||||||
- [bogemic](https://github.com/bogemic) fixed some C++17 deprecation warnings.
|
95. [bogemic](https://github.com/bogemic) fixed some C++17 deprecation warnings.
|
||||||
- [Eren Okka](https://github.com/erengy) fixed some MSVC warnings.
|
96. [Eren Okka](https://github.com/erengy) fixed some MSVC warnings.
|
||||||
- [abolz](https://github.com/abolz) integrated the Grisu2 algorithm for proper floating-point formatting, allowing more roundtrip checks to succeed.
|
97. [abolz](https://github.com/abolz) integrated the Grisu2 algorithm for proper floating-point formatting, allowing more roundtrip checks to succeed.
|
||||||
- [Vadim Evard](https://github.com/Pipeliner) fixed a Markdown issue in the README.
|
98. [Vadim Evard](https://github.com/Pipeliner) fixed a Markdown issue in the README.
|
||||||
- [zerodefect](https://github.com/zerodefect) fixed a compiler warning.
|
99. [zerodefect](https://github.com/zerodefect) fixed a compiler warning.
|
||||||
- [Kert](https://github.com/kaidokert) allowed to template the string type in the serialization and added the possibility to override the exceptional behavior.
|
100. [Kert](https://github.com/kaidokert) allowed to template the string type in the serialization and added the possibility to override the exceptional behavior.
|
||||||
- [mark-99](https://github.com/mark-99) helped fixing an ICC error.
|
101. [mark-99](https://github.com/mark-99) helped fixing an ICC error.
|
||||||
- [Patrik Huber](https://github.com/patrikhuber) fixed links in the README file.
|
102. [Patrik Huber](https://github.com/patrikhuber) fixed links in the README file.
|
||||||
- [johnfb](https://github.com/johnfb) found a bug in the implementation of CBOR's indefinite length strings.
|
103. [johnfb](https://github.com/johnfb) found a bug in the implementation of CBOR's indefinite length strings.
|
||||||
- [Paul Fultz II](https://github.com/pfultz2) added a note on the cget package manager.
|
104. [Paul Fultz II](https://github.com/pfultz2) added a note on the cget package manager.
|
||||||
- [Wilson Lin](https://github.com/wla80) made the integration section of the README more concise.
|
105. [Wilson Lin](https://github.com/wla80) made the integration section of the README more concise.
|
||||||
- [RalfBielig](https://github.com/ralfbielig) detected and fixed a memory leak in the parser callback.
|
106. [RalfBielig](https://github.com/ralfbielig) detected and fixed a memory leak in the parser callback.
|
||||||
- [agrianius](https://github.com/agrianius) allowed to dump JSON to an alternative string type.
|
107. [agrianius](https://github.com/agrianius) allowed to dump JSON to an alternative string type.
|
||||||
- [Kevin Tonon](https://github.com/ktonon) overworked the C++11 compiler checks in CMake.
|
108. [Kevin Tonon](https://github.com/ktonon) overworked the C++11 compiler checks in CMake.
|
||||||
- [Axel Huebl](https://github.com/ax3l) simplified a CMake check and added support for the [Spack package manager](https://spack.io).
|
109. [Axel Huebl](https://github.com/ax3l) simplified a CMake check and added support for the [Spack package manager](https://spack.io).
|
||||||
- [Carlos O'Ryan](https://github.com/coryan) fixed a typo.
|
110. [Carlos O'Ryan](https://github.com/coryan) fixed a typo.
|
||||||
- [James Upjohn](https://github.com/jammehcow) fixed a version number in the compilers section.
|
111. [James Upjohn](https://github.com/jammehcow) fixed a version number in the compilers section.
|
||||||
- [Chuck Atkins](https://github.com/chuckatkins) adjusted the CMake files to the CMake packaging guidelines and provided documentation for the CMake integration.
|
112. [Chuck Atkins](https://github.com/chuckatkins) adjusted the CMake files to the CMake packaging guidelines and provided documentation for the CMake integration.
|
||||||
- [Jan Schöppach](https://github.com/dns13) fixed a typo.
|
113. [Jan Schöppach](https://github.com/dns13) fixed a typo.
|
||||||
- [martin-mfg](https://github.com/martin-mfg) fixed a typo.
|
114. [martin-mfg](https://github.com/martin-mfg) fixed a typo.
|
||||||
- [Matthias Möller](https://github.com/TinyTinni) removed the dependency from `std::stringstream`.
|
115. [Matthias Möller](https://github.com/TinyTinni) removed the dependency from `std::stringstream`.
|
||||||
- [agrianius](https://github.com/agrianius) added code to use alternative string implementations.
|
116. [agrianius](https://github.com/agrianius) added code to use alternative string implementations.
|
||||||
- [Daniel599](https://github.com/Daniel599) allowed to use more algorithms with the `items()` function.
|
117. [Daniel599](https://github.com/Daniel599) allowed to use more algorithms with the `items()` function.
|
||||||
- [Julius Rakow](https://github.com/jrakow) fixed the Meson include directory and fixed the links to [cppreference.com](cppreference.com).
|
118. [Julius Rakow](https://github.com/jrakow) fixed the Meson include directory and fixed the links to [cppreference.com](cppreference.com).
|
||||||
- [Sonu Lohani](https://github.com/sonulohani) fixed the compilation with MSVC 2015 in debug mode.
|
119. [Sonu Lohani](https://github.com/sonulohani) fixed the compilation with MSVC 2015 in debug mode.
|
||||||
- [grembo](https://github.com/grembo) fixed the test suite and re-enabled several test cases.
|
120. [grembo](https://github.com/grembo) fixed the test suite and re-enabled several test cases.
|
||||||
- [Hyeon Kim](https://github.com/simnalamburt) introduced the macro `JSON_INTERNAL_CATCH` to control the exception handling inside the library.
|
121. [Hyeon Kim](https://github.com/simnalamburt) introduced the macro `JSON_INTERNAL_CATCH` to control the exception handling inside the library.
|
||||||
- [thyu](https://github.com/thyu) fixed a compiler warning.
|
122. [thyu](https://github.com/thyu) fixed a compiler warning.
|
||||||
- [David Guthrie](https://github.com/LEgregius) fixed a subtle compilation error with Clang 3.4.2.
|
123. [David Guthrie](https://github.com/LEgregius) fixed a subtle compilation error with Clang 3.4.2.
|
||||||
- [Dennis Fischer](https://github.com/dennisfischer) allowed to call `find_package` without installing the library.
|
124. [Dennis Fischer](https://github.com/dennisfischer) allowed to call `find_package` without installing the library.
|
||||||
- [Hyeon Kim](https://github.com/simnalamburt) fixed an issue with a double macro definition.
|
125. [Hyeon Kim](https://github.com/simnalamburt) fixed an issue with a double macro definition.
|
||||||
- [Ben Berman](https://github.com/rivertam) made some error messages more understandable.
|
126. [Ben Berman](https://github.com/rivertam) made some error messages more understandable.
|
||||||
- [zakalibit](https://github.com/zakalibit) fixed a compilation problem with the Intel C++ compiler.
|
127. [zakalibit](https://github.com/zakalibit) fixed a compilation problem with the Intel C++ compiler.
|
||||||
- [mandreyel](https://github.com/mandreyel) fixed a compilation problem.
|
128. [mandreyel](https://github.com/mandreyel) fixed a compilation problem.
|
||||||
- [Kostiantyn Ponomarenko](https://github.com/koponomarenko) added version and license information to the Meson build file.
|
129. [Kostiantyn Ponomarenko](https://github.com/koponomarenko) added version and license information to the Meson build file.
|
||||||
- [Henry Schreiner](https://github.com/henryiii) added support for GCC 4.8.
|
130. [Henry Schreiner](https://github.com/henryiii) added support for GCC 4.8.
|
||||||
- [knilch](https://github.com/knilch0r) made sure the test suite does not stall when run in the wrong directory.
|
131. [knilch](https://github.com/knilch0r) made sure the test suite does not stall when run in the wrong directory.
|
||||||
- [Antonio Borondo](https://github.com/antonioborondo) fixed an MSVC 2017 warning.
|
132. [Antonio Borondo](https://github.com/antonioborondo) fixed an MSVC 2017 warning.
|
||||||
- [Dan Gendreau](https://github.com/dgendreau) implemented the `NLOHMANN_JSON_SERIALIZE_ENUM` macro to quickly define an enum/JSON mapping.
|
133. [Dan Gendreau](https://github.com/dgendreau) implemented the `NLOHMANN_JSON_SERIALIZE_ENUM` macro to quickly define an enum/JSON mapping.
|
||||||
- [efp](https://github.com/efp) added line and column information to parse errors.
|
134. [efp](https://github.com/efp) added line and column information to parse errors.
|
||||||
- [julian-becker](https://github.com/julian-becker) added BSON support.
|
135. [julian-becker](https://github.com/julian-becker) added BSON support.
|
||||||
- [Pratik Chowdhury](https://github.com/pratikpc) added support for structured bindings.
|
136. [Pratik Chowdhury](https://github.com/pratikpc) added support for structured bindings.
|
||||||
- [David Avedissian](https://github.com/davedissian) added support for Clang 5.0.1 (PS4 version).
|
137. [David Avedissian](https://github.com/davedissian) added support for Clang 5.0.1 (PS4 version).
|
||||||
- [Jonathan Dumaresq](https://github.com/dumarjo) implemented an input adapter to read from `FILE*`.
|
138. [Jonathan Dumaresq](https://github.com/dumarjo) implemented an input adapter to read from `FILE*`.
|
||||||
- [kjpus](https://github.com/kjpus) fixed a link in the documentation.
|
139. [kjpus](https://github.com/kjpus) fixed a link in the documentation.
|
||||||
- [Manvendra Singh](https://github.com/manu-chroma) fixed a typo in the documentation.
|
140. [Manvendra Singh](https://github.com/manu-chroma) fixed a typo in the documentation.
|
||||||
- [ziggurat29](https://github.com/ziggurat29) fixed an MSVC warning.
|
141. [ziggurat29](https://github.com/ziggurat29) fixed an MSVC warning.
|
||||||
- [Sylvain Corlay](https://github.com/SylvainCorlay) added code to avoid an issue with MSVC.
|
142. [Sylvain Corlay](https://github.com/SylvainCorlay) added code to avoid an issue with MSVC.
|
||||||
- [mefyl](https://github.com/mefyl) fixed a bug when JSON was parsed from an input stream.
|
143. [mefyl](https://github.com/mefyl) fixed a bug when JSON was parsed from an input stream.
|
||||||
- [Millian Poquet](https://github.com/mpoquet) allowed to install the library via Meson.
|
144. [Millian Poquet](https://github.com/mpoquet) allowed to install the library via Meson.
|
||||||
- [Michael Behrns-Miller](https://github.com/moodboom) found an issue with a missing namespace.
|
145. [Michael Behrns-Miller](https://github.com/moodboom) found an issue with a missing namespace.
|
||||||
- [Nasztanovics Ferenc](https://github.com/naszta) fixed a compilation issue with libc 2.12.
|
146. [Nasztanovics Ferenc](https://github.com/naszta) fixed a compilation issue with libc 2.12.
|
||||||
- [Andreas Schwab](https://github.com/andreas-schwab) fixed the endian conversion.
|
147. [Andreas Schwab](https://github.com/andreas-schwab) fixed the endian conversion.
|
||||||
- [Mark-Dunning](https://github.com/Mark-Dunning) fixed a warning in MSVC.
|
148. [Mark-Dunning](https://github.com/Mark-Dunning) fixed a warning in MSVC.
|
||||||
- [Gareth Sylvester-Bradley](https://github.com/garethsb-sony) added `operator/` for JSON Pointers.
|
149. [Gareth Sylvester-Bradley](https://github.com/garethsb-sony) added `operator/` for JSON Pointers.
|
||||||
- [John-Mark](https://github.com/johnmarkwayve) noted a missing header.
|
150. [John-Mark](https://github.com/johnmarkwayve) noted a missing header.
|
||||||
- [Vitaly Zaitsev](https://github.com/xvitaly) fixed compilation with GCC 9.0.
|
151. [Vitaly Zaitsev](https://github.com/xvitaly) fixed compilation with GCC 9.0.
|
||||||
- [Laurent Stacul](https://github.com/stac47) fixed compilation with GCC 9.0.
|
152. [Laurent Stacul](https://github.com/stac47) fixed compilation with GCC 9.0.
|
||||||
- [Ivor Wanders](https://github.com/iwanders) helped to reduce the CMake requirement to version 3.1.
|
153. [Ivor Wanders](https://github.com/iwanders) helped to reduce the CMake requirement to version 3.1.
|
||||||
- [njlr](https://github.com/njlr) updated the Buckaroo instructions.
|
154. [njlr](https://github.com/njlr) updated the Buckaroo instructions.
|
||||||
- [Lion](https://github.com/lieff) fixed a compilation issue with GCC 7 on CentOS.
|
155. [Lion](https://github.com/lieff) fixed a compilation issue with GCC 7 on CentOS.
|
||||||
- [Isaac Nickaein](https://github.com/nickaein) improved the integer serialization performance and implemented the `contains()` function.
|
156. [Isaac Nickaein](https://github.com/nickaein) improved the integer serialization performance and implemented the `contains()` function.
|
||||||
- [past-due](https://github.com/past-due) suppressed an unfixable warning.
|
157. [past-due](https://github.com/past-due) suppressed an unfixable warning.
|
||||||
- [Elvis Oric](https://github.com/elvisoric) improved Meson support.
|
158. [Elvis Oric](https://github.com/elvisoric) improved Meson support.
|
||||||
- [Matěj Plch](https://github.com/Afforix) fixed an example in the README.
|
159. [Matěj Plch](https://github.com/Afforix) fixed an example in the README.
|
||||||
- [Mark Beckwith](https://github.com/wythe) fixed a typo.
|
160. [Mark Beckwith](https://github.com/wythe) fixed a typo.
|
||||||
- [scinart](https://github.com/scinart) fixed bug in the serializer.
|
161. [scinart](https://github.com/scinart) fixed bug in the serializer.
|
||||||
- [Patrick Boettcher](https://github.com/pboettch) implemented `push_back()` and `pop_back()` for JSON Pointers.
|
162. [Patrick Boettcher](https://github.com/pboettch) implemented `push_back()` and `pop_back()` for JSON Pointers.
|
||||||
- [Bruno Oliveira](https://github.com/nicoddemus) added support for Conda.
|
163. [Bruno Oliveira](https://github.com/nicoddemus) added support for Conda.
|
||||||
- [Michele Caini](https://github.com/skypjack) fixed links in the README.
|
164. [Michele Caini](https://github.com/skypjack) fixed links in the README.
|
||||||
- [Hani](https://github.com/hnkb) documented how to install the library with NuGet.
|
165. [Hani](https://github.com/hnkb) documented how to install the library with NuGet.
|
||||||
- [Mark Beckwith](https://github.com/wythe) fixed a typo.
|
166. [Mark Beckwith](https://github.com/wythe) fixed a typo.
|
||||||
- [yann-morin-1998](https://github.com/yann-morin-1998) helped to reduce the CMake requirement to version 3.1.
|
167. [yann-morin-1998](https://github.com/yann-morin-1998) helped to reduce the CMake requirement to version 3.1.
|
||||||
- [Konstantin Podsvirov](https://github.com/podsvirov) maintains a package for the MSYS2 software distro.
|
168. [Konstantin Podsvirov](https://github.com/podsvirov) maintains a package for the MSYS2 software distro.
|
||||||
- [remyabel](https://github.com/remyabel) added GNUInstallDirs to the CMake files.
|
169. [remyabel](https://github.com/remyabel) added GNUInstallDirs to the CMake files.
|
||||||
- [Taylor Howard](https://github.com/taylorhoward92) fixed a unit test.
|
170. [Taylor Howard](https://github.com/taylorhoward92) fixed a unit test.
|
||||||
- [Gabe Ron](https://github.com/Macr0Nerd) implemented the `to_string` method.
|
171. [Gabe Ron](https://github.com/Macr0Nerd) implemented the `to_string` method.
|
||||||
- [Watal M. Iwasaki](https://github.com/heavywatal) fixed a Clang warning.
|
172. [Watal M. Iwasaki](https://github.com/heavywatal) fixed a Clang warning.
|
||||||
- [Viktor Kirilov](https://github.com/onqtam) switched the unit tests from [Catch](https://github.com/philsquared/Catch) to [doctest](https://github.com/onqtam/doctest)
|
173. [Viktor Kirilov](https://github.com/onqtam) switched the unit tests from [Catch](https://github.com/philsquared/Catch) to [doctest](https://github.com/onqtam/doctest)
|
||||||
- [Juncheng E](https://github.com/ejcjason) fixed a typo.
|
174. [Juncheng E](https://github.com/ejcjason) fixed a typo.
|
||||||
- [tete17](https://github.com/tete17) fixed a bug in the `contains` function.
|
175. [tete17](https://github.com/tete17) fixed a bug in the `contains` function.
|
||||||
- [Xav83](https://github.com/Xav83) fixed some cppcheck warnings.
|
176. [Xav83](https://github.com/Xav83) fixed some cppcheck warnings.
|
||||||
- [0xflotus](https://github.com/0xflotus) fixed some typos.
|
177. [0xflotus](https://github.com/0xflotus) fixed some typos.
|
||||||
- [Christian Deneke](https://github.com/chris0x44) added a const version of `json_pointer::back`.
|
178. [Christian Deneke](https://github.com/chris0x44) added a const version of `json_pointer::back`.
|
||||||
- [Julien Hamaide](https://github.com/crazyjul) made the `items()` function work with custom string types.
|
179. [Julien Hamaide](https://github.com/crazyjul) made the `items()` function work with custom string types.
|
||||||
- [Evan Nemerson](https://github.com/nemequ) updated fixed a bug in Hedley and updated this library accordingly.
|
180. [Evan Nemerson](https://github.com/nemequ) updated fixed a bug in Hedley and updated this library accordingly.
|
||||||
- [Florian Pigorsch](https://github.com/flopp) fixed a lot of typos.
|
181. [Florian Pigorsch](https://github.com/flopp) fixed a lot of typos.
|
||||||
- [Camille Bégué](https://github.com/cbegue) fixed an issue in the conversion from `std::pair` and `std::tuple` to `json`.
|
182. [Camille Bégué](https://github.com/cbegue) fixed an issue in the conversion from `std::pair` and `std::tuple` to `json`.
|
||||||
- [Anthony VH](https://github.com/AnthonyVH) fixed a compile error in an enum deserialization.
|
183. [Anthony VH](https://github.com/AnthonyVH) fixed a compile error in an enum deserialization.
|
||||||
- [Yuriy Vountesmery](https://github.com/ua-code-dragon) noted a subtle bug in a preprocessor check.
|
184. [Yuriy Vountesmery](https://github.com/ua-code-dragon) noted a subtle bug in a preprocessor check.
|
||||||
- [Chen](https://github.com/dota17) fixed numerous issues in the library.
|
185. [Chen](https://github.com/dota17) fixed numerous issues in the library.
|
||||||
- [Antony Kellermann](https://github.com/aokellermann) added a CI step for GCC 10.1.
|
186. [Antony Kellermann](https://github.com/aokellermann) added a CI step for GCC 10.1.
|
||||||
- [Alex](https://github.com/gistrec) fixed an MSVC warning.
|
187. [Alex](https://github.com/gistrec) fixed an MSVC warning.
|
||||||
- [Rainer](https://github.com/rvjr) proposed an improvement in the floating-point serialization in CBOR.
|
188. [Rainer](https://github.com/rvjr) proposed an improvement in the floating-point serialization in CBOR.
|
||||||
- [Francois Chabot](https://github.com/FrancoisChabot) made performance improvements in the input adapters.
|
189. [Francois Chabot](https://github.com/FrancoisChabot) made performance improvements in the input adapters.
|
||||||
- [Arthur Sonzogni](https://github.com/ArthurSonzogni) documented how the library can be included via `FetchContent`.
|
190. [Arthur Sonzogni](https://github.com/ArthurSonzogni) documented how the library can be included via `FetchContent`.
|
||||||
- [Rimas Misevičius](https://github.com/rmisev) fixed an error message.
|
191. [Rimas Misevičius](https://github.com/rmisev) fixed an error message.
|
||||||
- [Alexander Myasnikov](https://github.com/alexandermyasnikov) fixed some examples and a link in the README.
|
192. [Alexander Myasnikov](https://github.com/alexandermyasnikov) fixed some examples and a link in the README.
|
||||||
- [Hubert Chathi](https://github.com/uhoreg) made CMake's version config file architecture-independent.
|
193. [Hubert Chathi](https://github.com/uhoreg) made CMake's version config file architecture-independent.
|
||||||
- [OmnipotentEntity](https://github.com/OmnipotentEntity) implemented the binary values for CBOR, MessagePack, BSON, and UBJSON.
|
194. [OmnipotentEntity](https://github.com/OmnipotentEntity) implemented the binary values for CBOR, MessagePack, BSON, and UBJSON.
|
||||||
- [ArtemSarmini](https://github.com/ArtemSarmini) fixed a compilation issue with GCC 10 and fixed a leak.
|
195. [ArtemSarmini](https://github.com/ArtemSarmini) fixed a compilation issue with GCC 10 and fixed a leak.
|
||||||
- [Evgenii Sopov](https://github.com/sea-kg) integrated the library to the wsjcpp package manager.
|
196. [Evgenii Sopov](https://github.com/sea-kg) integrated the library to the wsjcpp package manager.
|
||||||
- [Sergey Linev](https://github.com/linev) fixed a compiler warning.
|
197. [Sergey Linev](https://github.com/linev) fixed a compiler warning.
|
||||||
- [Miguel Magalhães](https://github.com/magamig) fixed the year in the copyright.
|
198. [Miguel Magalhães](https://github.com/magamig) fixed the year in the copyright.
|
||||||
- [Gareth Sylvester-Bradley](https://github.com/garethsb-sony) fixed a compilation issue with MSVC.
|
199. [Gareth Sylvester-Bradley](https://github.com/garethsb-sony) fixed a compilation issue with MSVC.
|
||||||
- [Alexander “weej” Jones](https://github.com/alex-weej) fixed an example in the README.
|
200. [Alexander “weej” Jones](https://github.com/alex-weej) fixed an example in the README.
|
||||||
- [Antoine Cœur](https://github.com/Coeur) fixed some typos in the documentation.
|
201. [Antoine Cœur](https://github.com/Coeur) fixed some typos in the documentation.
|
||||||
- [jothepro](https://github.com/jothepro) updated links to the Hunter package.
|
202. [jothepro](https://github.com/jothepro) updated links to the Hunter package.
|
||||||
- [Dave Lee](https://github.com/kastiglione) fixed link in the README.
|
203. [Dave Lee](https://github.com/kastiglione) fixed link in the README.
|
||||||
- [Joël Lamotte](https://github.com/Klaim) added instruction for using Build2's package manager.
|
204. [Joël Lamotte](https://github.com/Klaim) added instruction for using Build2's package manager.
|
||||||
- [Paul Jurczak](https://github.com/pauljurczak) fixed an example in the README.
|
205. [Paul Jurczak](https://github.com/pauljurczak) fixed an example in the README.
|
||||||
- [Sonu Lohani](https://github.com/sonulohani) fixed a warning.
|
206. [Sonu Lohani](https://github.com/sonulohani) fixed a warning.
|
||||||
- [Carlos Gomes Martinho](https://github.com/gocarlos) updated the Conan package source.
|
207. [Carlos Gomes Martinho](https://github.com/gocarlos) updated the Conan package source.
|
||||||
- [Konstantin Podsvirov](https://github.com/podsvirov) fixed the MSYS2 package documentation.
|
208. [Konstantin Podsvirov](https://github.com/podsvirov) fixed the MSYS2 package documentation.
|
||||||
- [Tridacnid](https://github.com/Tridacnid) improved the CMake tests.
|
209. [Tridacnid](https://github.com/Tridacnid) improved the CMake tests.
|
||||||
- [Michael](https://github.com/MBalszun) fixed MSVC warnings.
|
210. [Michael](https://github.com/MBalszun) fixed MSVC warnings.
|
||||||
- [Quentin Barbarat](https://github.com/quentin-dev) fixed an example in the documentation.
|
211. [Quentin Barbarat](https://github.com/quentin-dev) fixed an example in the documentation.
|
||||||
- [XyFreak](https://github.com/XyFreak) fixed a compiler warning.
|
212. [XyFreak](https://github.com/XyFreak) fixed a compiler warning.
|
||||||
- [TotalCaesar659](https://github.com/TotalCaesar659) fixed links in the README.
|
213. [TotalCaesar659](https://github.com/TotalCaesar659) fixed links in the README.
|
||||||
- [Tanuj Garg](https://github.com/tanuj208) improved the fuzzer coverage for UBSAN input.
|
214. [Tanuj Garg](https://github.com/tanuj208) improved the fuzzer coverage for UBSAN input.
|
||||||
- [AODQ](https://github.com/AODQ) fixed a compiler warning.
|
215. [AODQ](https://github.com/AODQ) fixed a compiler warning.
|
||||||
- [jwittbrodt](https://github.com/jwittbrodt) made `NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE` inline.
|
216. [jwittbrodt](https://github.com/jwittbrodt) made `NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE` inline.
|
||||||
- [pfeatherstone](https://github.com/pfeatherstone) improved the upper bound of arguments of the `NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE`/`NLOHMANN_DEFINE_TYPE_INTRUSIVE` macros.
|
217. [pfeatherstone](https://github.com/pfeatherstone) improved the upper bound of arguments of the `NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE`/`NLOHMANN_DEFINE_TYPE_INTRUSIVE` macros.
|
||||||
- [Jan Procházka](https://github.com/jprochazk) fixed a bug in the CBOR parser for binary and string values.
|
218. [Jan Procházka](https://github.com/jprochazk) fixed a bug in the CBOR parser for binary and string values.
|
||||||
- [T0b1-iOS](https://github.com/T0b1-iOS) fixed a bug in the new hash implementation.
|
219. [T0b1-iOS](https://github.com/T0b1-iOS) fixed a bug in the new hash implementation.
|
||||||
- [Matthew Bauer](https://github.com/matthewbauer) adjusted the CBOR writer to create tags for binary subtypes.
|
220. [Matthew Bauer](https://github.com/matthewbauer) adjusted the CBOR writer to create tags for binary subtypes.
|
||||||
- [gatopeich](https://github.com/gatopeich) implemented an ordered map container for `nlohmann::ordered_json`.
|
221. [gatopeich](https://github.com/gatopeich) implemented an ordered map container for `nlohmann::ordered_json`.
|
||||||
- [Érico Nogueira Rolim](https://github.com/ericonr) added support for pkg-config.
|
222. [Érico Nogueira Rolim](https://github.com/ericonr) added support for pkg-config.
|
||||||
- [KonanM](https://github.com/KonanM) proposed an implementation for the `NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE`/`NLOHMANN_DEFINE_TYPE_INTRUSIVE` macros.
|
223. [KonanM](https://github.com/KonanM) proposed an implementation for the `NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE`/`NLOHMANN_DEFINE_TYPE_INTRUSIVE` macros.
|
||||||
- [Guillaume Racicot](https://github.com/gracicot) implemented `string_view` support and allowed C++20 support.
|
224. [Guillaume Racicot](https://github.com/gracicot) implemented `string_view` support and allowed C++20 support.
|
||||||
- [Alex Reinking](https://github.com/alexreinking) improved CMake support for `FetchContent`.
|
225. [Alex Reinking](https://github.com/alexreinking) improved CMake support for `FetchContent`.
|
||||||
- [Hannes Domani](https://github.com/ssbssa) provided a GDB pretty printer.
|
226. [Hannes Domani](https://github.com/ssbssa) provided a GDB pretty printer.
|
||||||
- Lars Wirzenius reviewed the README file.
|
227. Lars Wirzenius reviewed the README file.
|
||||||
- [Jun Jie](https://github.com/ongjunjie) fixed a compiler path in the CMake scripts.
|
228. [Jun Jie](https://github.com/ongjunjie) fixed a compiler path in the CMake scripts.
|
||||||
- [Ronak Buch](https://github.com/rbuch) fixed typos in the documentation.
|
229. [Ronak Buch](https://github.com/rbuch) fixed typos in the documentation.
|
||||||
- [Alexander Karzhenkov](https://github.com/karzhenkov) fixed a move constructor and the Travis builds.
|
230. [Alexander Karzhenkov](https://github.com/karzhenkov) fixed a move constructor and the Travis builds.
|
||||||
- [Leonardo Lima](https://github.com/leozz37) added CPM.Cmake support.
|
231. [Leonardo Lima](https://github.com/leozz37) added CPM.Cmake support.
|
||||||
- [Joseph Blackman](https://github.com/jbzdarkid) fixed a warning.
|
232. [Joseph Blackman](https://github.com/jbzdarkid) fixed a warning.
|
||||||
- [Yaroslav](https://github.com/YarikTH) updated doctest and implemented unit tests.
|
233. [Yaroslav](https://github.com/YarikTH) updated doctest and implemented unit tests.
|
||||||
- [Martin Stump](https://github.com/globberwops) fixed a bug in the CMake files.
|
234. [Martin Stump](https://github.com/globberwops) fixed a bug in the CMake files.
|
||||||
- [Jaakko Moisio](https://github.com/jasujm) fixed a bug in the input adapters.
|
235. [Jaakko Moisio](https://github.com/jasujm) fixed a bug in the input adapters.
|
||||||
- [bl-ue](https://github.com/bl-ue) fixed some Markdown issues in the README file.
|
236. [bl-ue](https://github.com/bl-ue) fixed some Markdown issues in the README file.
|
||||||
- [William A. Wieselquist](https://github.com/wawiesel) fixed an example from the README.
|
237. [William A. Wieselquist](https://github.com/wawiesel) fixed an example from the README.
|
||||||
- [abbaswasim](https://github.com/abbaswasim) fixed an example from the README.
|
238. [abbaswasim](https://github.com/abbaswasim) fixed an example from the README.
|
||||||
- [Remy Jette](https://github.com/remyjette) fixed a warning.
|
239. [Remy Jette](https://github.com/remyjette) fixed a warning.
|
||||||
- [Fraser](https://github.com/frasermarlow) fixed the documentation.
|
240. [Fraser](https://github.com/frasermarlow) fixed the documentation.
|
||||||
- [Ben Beasley](https://github.com/musicinmybrain) updated doctest.
|
241. [Ben Beasley](https://github.com/musicinmybrain) updated doctest.
|
||||||
- [Doron Behar](https://github.com/doronbehar) fixed pkg-config.pc.
|
242. [Doron Behar](https://github.com/doronbehar) fixed pkg-config.pc.
|
||||||
- [raduteo](https://github.com/raduteo) fixed a warning.
|
243. [raduteo](https://github.com/raduteo) fixed a warning.
|
||||||
- [David Pfahler](https://github.com/theShmoo) added the possibility to compile the library without I/O support.
|
244. [David Pfahler](https://github.com/theShmoo) added the possibility to compile the library without I/O support.
|
||||||
- [Morten Fyhn Amundsen](https://github.com/mortenfyhn) fixed a typo.
|
245. [Morten Fyhn Amundsen](https://github.com/mortenfyhn) fixed a typo.
|
||||||
- [jpl-mac](https://github.com/jpl-mac) allowed to treat the library as a system header in CMake.
|
246. [jpl-mac](https://github.com/jpl-mac) allowed to treat the library as a system header in CMake.
|
||||||
- [Jason Dsouza](https://github.com/jasmcaus) fixed the indentation of the CMake file.
|
247. [Jason Dsouza](https://github.com/jasmcaus) fixed the indentation of the CMake file.
|
||||||
- [offa](https://github.com/offa) added a link to Conan Center to the documentation.
|
248. [offa](https://github.com/offa) added a link to Conan Center to the documentation.
|
||||||
- [TotalCaesar659](https://github.com/TotalCaesar659) updated the links in the documentation to use HTTPS.
|
249. [TotalCaesar659](https://github.com/TotalCaesar659) updated the links in the documentation to use HTTPS.
|
||||||
- [Rafail Giavrimis](https://github.com/grafail) fixed the Google Benchmark default branch.
|
250. [Rafail Giavrimis](https://github.com/grafail) fixed the Google Benchmark default branch.
|
||||||
- [Louis Dionne](https://github.com/ldionne) fixed a conversion operator.
|
251. [Louis Dionne](https://github.com/ldionne) fixed a conversion operator.
|
||||||
- [justanotheranonymoususer](https://github.com/justanotheranonymoususer) made the examples in the README more consistent.
|
252. [justanotheranonymoususer](https://github.com/justanotheranonymoususer) made the examples in the README more consistent.
|
||||||
- [Finkman](https://github.com/Finkman) suppressed some `-Wfloat-equal` warnings.
|
253. [Finkman](https://github.com/Finkman) suppressed some `-Wfloat-equal` warnings.
|
||||||
- [Ferry Huberts](https://github.com/fhuberts) fixed `-Wswitch-enum` warnings.
|
254. [Ferry Huberts](https://github.com/fhuberts) fixed `-Wswitch-enum` warnings.
|
||||||
- [Arseniy Terekhin](https://github.com/senyai) made the GDB pretty-printer robust against unset variable names.
|
255. [Arseniy Terekhin](https://github.com/senyai) made the GDB pretty-printer robust against unset variable names.
|
||||||
- [Amir Masoud Abdol](https://github.com/amirmasoudabdol) updated the Homebrew command as nlohmann/json is now in homebrew-core.
|
256. [Amir Masoud Abdol](https://github.com/amirmasoudabdol) updated the Homebrew command as nlohmann/json is now in homebrew-core.
|
||||||
- [Hallot](https://github.com/Hallot) fixed some `-Wextra-semi-stmt warnings`.
|
257. [Hallot](https://github.com/Hallot) fixed some `-Wextra-semi-stmt warnings`.
|
||||||
- [Giovanni Cerretani](https://github.com/gcerretani) fixed `-Wunused` warnings on `JSON_DIAGNOSTICS`.
|
258. [Giovanni Cerretani](https://github.com/gcerretani) fixed `-Wunused` warnings on `JSON_DIAGNOSTICS`.
|
||||||
- [Bogdan Popescu](https://github.com/Kapeli) hosts the [docset](https://github.com/Kapeli/Dash-User-Contributions/tree/master/docsets/JSON_for_Modern_C%2B%2B) for offline documentation viewers.
|
259. [Bogdan Popescu](https://github.com/Kapeli) hosts the [docset](https://github.com/Kapeli/Dash-User-Contributions/tree/master/docsets/JSON_for_Modern_C%2B%2B) for offline documentation viewers.
|
||||||
- [Carl Smedstad](https://github.com/carlsmedstad) fixed an assertion error when using `JSON_DIAGNOSTICS`.
|
260. [Carl Smedstad](https://github.com/carlsmedstad) fixed an assertion error when using `JSON_DIAGNOSTICS`.
|
||||||
- [miikka75](https://github.com/miikka75) provided an important fix to compile C++17 code with Clang 9.
|
261. [miikka75](https://github.com/miikka75) provided an important fix to compile C++17 code with Clang 9.
|
||||||
- [Maarten Becker](https://github.com/kernie) fixed a warning for shadowed variables.
|
262. [Maarten Becker](https://github.com/kernie) fixed a warning for shadowed variables.
|
||||||
- [Cristi Vîjdea](https://github.com/axnsan12) fixed typos in the `operator[]` documentation.
|
263. [Cristi Vîjdea](https://github.com/axnsan12) fixed typos in the `operator[]` documentation.
|
||||||
- [Alex Beregszaszi](https://github.com/axic) fixed spelling mistakes in comments.
|
264. [Alex Beregszaszi](https://github.com/axic) fixed spelling mistakes in comments.
|
||||||
- [Dirk Stolle](https://github.com/striezel) fixed typos in documentation.
|
265. [Dirk Stolle](https://github.com/striezel) fixed typos in documentation.
|
||||||
- [Daniel Albuschat](https://github.com/daniel-kun) corrected the parameter name in the `parse` documentation.
|
266. [Daniel Albuschat](https://github.com/daniel-kun) corrected the parameter name in the `parse` documentation.
|
||||||
- [Prince Mendiratta](https://github.com/Prince-Mendiratta) fixed a link to the FAQ.
|
267. [Prince Mendiratta](https://github.com/Prince-Mendiratta) fixed a link to the FAQ.
|
||||||
- [Florian Albrechtskirchinger](https://github.com/falbrechtskirchinger) implemented `std::string_view` support for object keys and made dozens of other improvements.
|
268. [Florian Albrechtskirchinger](https://github.com/falbrechtskirchinger) implemented `std::string_view` support for object keys and made dozens of other improvements.
|
||||||
- [Qianqian Fang](https://github.com/fangq) implemented the Binary JData (BJData) format.
|
269. [Qianqian Fang](https://github.com/fangq) implemented the Binary JData (BJData) format.
|
||||||
- [pketelsen](https://github.com/pketelsen) added macros `NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT` and `NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT`.
|
270. [pketelsen](https://github.com/pketelsen) added macros `NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT` and `NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT`.
|
||||||
- [DarkZeros](https://github.com/DarkZeros) adjusted to code to not clash with Arduino defines.
|
271. [DarkZeros](https://github.com/DarkZeros) adjusted to code to not clash with Arduino defines.
|
||||||
- [flagarde](https://github.com/flagarde) fixed the output of `meta()` for MSVC.
|
272. [flagarde](https://github.com/flagarde) fixed the output of `meta()` for MSVC.
|
||||||
- [Giovanni Cerretani](https://github.com/gcerretani) fixed a check for `std::filesystem`.
|
273. [Giovanni Cerretani](https://github.com/gcerretani) fixed a check for `std::filesystem`.
|
||||||
- [Dimitris Apostolou](https://github.com/rex4539) fixed a typo.
|
274. [Dimitris Apostolou](https://github.com/rex4539) fixed a typo.
|
||||||
- [Ferry Huberts](https://github.com/fhuberts) fixed a typo.
|
275. [Ferry Huberts](https://github.com/fhuberts) fixed a typo.
|
||||||
- [Michael Nosthoff](https://github.com/heinemml) fixed a typo.
|
276. [Michael Nosthoff](https://github.com/heinemml) fixed a typo.
|
||||||
- [JungHoon Lee](https://github.com/jhnlee) fixed a typo.
|
277. [JungHoon Lee](https://github.com/jhnlee) fixed a typo.
|
||||||
- [Faruk D.](https://github.com/fdiblen) fixed the CITATION.CFF file.
|
278. [Faruk D.](https://github.com/fdiblen) fixed the CITATION.CFF file.
|
||||||
- [Andrea Cocito](https://github.com/puffetto) added a clarification on macro usage to the documentation.
|
279. [Andrea Cocito](https://github.com/puffetto) added a clarification on macro usage to the documentation.
|
||||||
- [Krzysiek Karbowiak](https://github.com/kkarbowiak) refactored the tests to use `CHECK_THROWS_WITH_AS`.
|
280. [Krzysiek Karbowiak](https://github.com/kkarbowiak) refactored the tests to use `CHECK_THROWS_WITH_AS`.
|
||||||
- [Chaoqi Zhang](https://github.com/prncoprs) fixed a typo.
|
281. [Chaoqi Zhang](https://github.com/prncoprs) fixed a typo.
|
||||||
- [ivanovmp](https://github.com/ivanovmp) fixed a whitespace error.
|
282. [ivanovmp](https://github.com/ivanovmp) fixed a whitespace error.
|
||||||
|
283. [KsaNL](https://github.com/KsaNL) fixed a build error when including `<windows.h>`.
|
||||||
|
284. [Andrea Pappacoda](https://github.com/Tachi107) moved `.pc` and `.cmake` files to `share` directory.
|
||||||
|
285. [Wolf Vollprecht](https://github.com/wolfv) added the `patch_inplace` function.
|
||||||
|
286. [Jake Zimmerman](https://github.com/jez) highlighted common usage patterns in the README file.
|
||||||
|
287. [NN](https://github.com/NN---) added the Visual Studio output directory to `.gitignore`.
|
||||||
|
288. [Romain Reignier](https://github.com/romainreignier) improved the performance the vector output adapter.
|
||||||
|
289. [Mike](https://github.com/Mike-Leo-Smith) fixed the `std::iterator_traits`.
|
||||||
|
290. [Richard Hozák](https://github.com/zxey) added macro `JSON_NO_ENUM` to disable default enum conversions.
|
||||||
|
291. [vakokako](https://github.com/vakokako) fixed tests when compiling with C++20.
|
||||||
|
292. [Alexander “weej” Jones](https://github.com/alexweej) fixed an example in the README.
|
||||||
|
293. [Eli Schwartz](https://github.com/eli-schwartz) added more files to the `include.zip` archive.
|
||||||
|
294. [Kevin Lu](https://github.com/kevinlul) fixed a compilation issue when typedefs with certain names were present.
|
||||||
|
295. [Trevor Hickey](https://github.com/luxe) improved the description of an example.
|
||||||
|
296. [Jef LeCompte](https://github.com/jef) updated the year in the README file.
|
||||||
|
297. [Alexandre Hamez](https://github.com/ahamez) fixed a warning.
|
||||||
|
298. [Maninderpal Badhan](https://github.com/mbadhan) fixed a typo.
|
||||||
|
299. [kevin--](https://github.com/kevin--) added a note to an example in the README file.
|
||||||
|
300. [I](https://github.com/wx257osn2) fixed a typo.
|
||||||
|
301. [Gregorio Litenstein](https://github.com/Lord-Kamina) fixed the Clang detection.
|
||||||
|
302. [Andreas Smas](https://github.com/andoma) added a Doozer badge.
|
||||||
|
303. [WanCW](https://github.com/wancw) fixed the string conversion with Clang.
|
||||||
|
304. [zhaohuaxishi](https://github.com/zhaohuaxishi) fixed a Doxygen error.
|
||||||
|
305. [emvivre](https://github.com/emvivre) removed an invalid parameter from CMake.
|
||||||
|
306. [Tobias Hermann](https://github.com/Dobiasd) fixed a link in the README file.
|
||||||
|
307. [Michael](https://github.com/traits) fixed a warning.
|
||||||
|
308. [Ryan Mulder](https://github.com/ryanjmulder) added `ensure_ascii` to the `dump` function.
|
||||||
|
309. [Muri Nicanor](https://github.com/murinicanor) fixed the `sed` discovery in the Makefile.
|
||||||
|
310. [David Avedissian](https://github.com/dgavedissian) implemented SFINAE-friendly `iterator_traits`.
|
||||||
|
311. [AQNOUCH Mohammed](https://github.com/aqnouch) fixed a typo in the README.
|
||||||
|
312. [Gareth Sylvester-Bradley](https://github.com/garethsb) added `operator/=` and `operator/` to construct JSON pointers.
|
||||||
|
313. [Michael Macnair](https://github.com/mykter) added support for afl-fuzz testing.
|
||||||
|
314. [Berkus Decker](https://github.com/berkus) fixed a typo in the README.
|
||||||
|
315. [Illia Polishchuk](https://github.com/effolkronium) improved the CMake testing.
|
||||||
|
316. [Ikko Ashimine](https://github.com/eltociear) fixed a typo.
|
||||||
|
|
||||||
Thanks a lot for helping out! Please [let me know](mailto:mail@nlohmann.me) if I forgot someone.
|
Thanks a lot for helping out! Please [let me know](mailto:mail@nlohmann.me) if I forgot someone.
|
||||||
|
|
||||||
|
|||||||
@ -589,15 +589,22 @@ file(GLOB_RECURSE INDENT_FILES
|
|||||||
${PROJECT_SOURCE_DIR}/docs/examples/*.cpp
|
${PROJECT_SOURCE_DIR}/docs/examples/*.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
set(include_dir ${PROJECT_SOURCE_DIR}/single_include/nlohmann)
|
||||||
|
set(tool_dir ${PROJECT_SOURCE_DIR}/tools/amalgamate)
|
||||||
add_custom_target(ci_test_amalgamation
|
add_custom_target(ci_test_amalgamation
|
||||||
COMMAND rm -fr ${PROJECT_SOURCE_DIR}/single_include/nlohmann/json.hpp~
|
COMMAND rm -fr ${include_dir}/json.hpp~ ${include_dir}/json_fwd.hpp~
|
||||||
COMMAND cp ${PROJECT_SOURCE_DIR}/single_include/nlohmann/json.hpp ${PROJECT_SOURCE_DIR}/single_include/nlohmann/json.hpp~
|
COMMAND cp ${include_dir}/json.hpp ${include_dir}/json.hpp~
|
||||||
COMMAND ${Python3_EXECUTABLE} ${PROJECT_SOURCE_DIR}/tools/amalgamate/amalgamate.py -c ${PROJECT_SOURCE_DIR}/tools/amalgamate/config.json -s .
|
COMMAND cp ${include_dir}/json_fwd.hpp ${include_dir}/json_fwd.hpp~
|
||||||
COMMAND ${ASTYLE_TOOL} ${ASTYLE_FLAGS} --suffix=none --quiet ${PROJECT_SOURCE_DIR}/single_include/nlohmann/json.hpp
|
|
||||||
COMMAND diff ${PROJECT_SOURCE_DIR}/single_include/nlohmann/json.hpp~ ${PROJECT_SOURCE_DIR}/single_include/nlohmann/json.hpp
|
COMMAND ${Python3_EXECUTABLE} ${tool_dir}/amalgamate.py -c ${tool_dir}/config_json.json -s .
|
||||||
|
COMMAND ${Python3_EXECUTABLE} ${tool_dir}/amalgamate.py -c ${tool_dir}/config_json_fwd.json -s .
|
||||||
|
COMMAND ${ASTYLE_TOOL} ${ASTYLE_FLAGS} --suffix=none --quiet ${include_dir}/json.hpp ${include_dir}/json_fwd.hpp
|
||||||
|
|
||||||
|
COMMAND diff ${include_dir}/json.hpp~ ${include_dir}/json.hpp
|
||||||
|
COMMAND diff ${include_dir}/json_fwd.hpp~ ${include_dir}/json_fwd.hpp
|
||||||
|
|
||||||
COMMAND ${ASTYLE_TOOL} ${ASTYLE_FLAGS} ${INDENT_FILES}
|
COMMAND ${ASTYLE_TOOL} ${ASTYLE_FLAGS} ${INDENT_FILES}
|
||||||
COMMAND cd ${PROJECT_SOURCE_DIR} && for FILE in `find . -name '*.orig'`\; do false \; done
|
COMMAND for FILE in `find . -name '*.orig'`\; do false \; done
|
||||||
|
|
||||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||||
COMMENT "Check amalgamation and indentation"
|
COMMENT "Check amalgamation and indentation"
|
||||||
@ -953,12 +960,18 @@ add_custom_target(ci_icpc
|
|||||||
# test documentation
|
# test documentation
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
add_custom_target(ci_test_documentation
|
add_custom_target(ci_test_examples
|
||||||
COMMAND make CXX="${GCC_TOOL}" check_output_portable -j8
|
COMMAND make CXX="${GCC_TOOL}" check_output_portable -j8
|
||||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/docs
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/docs
|
||||||
COMMENT "Check that all examples compile and create the desired output"
|
COMMENT "Check that all examples compile and create the desired output"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
add_custom_target(ci_test_api_documentation
|
||||||
|
COMMAND ${Python3_EXECUTABLE} scripts/check_structure.py
|
||||||
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/docs/mkdocs
|
||||||
|
COMMENT "Lint the API documentation"
|
||||||
|
)
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Clean up all generated files.
|
# Clean up all generated files.
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|||||||
BIN
docs/avatars.png
BIN
docs/avatars.png
Binary file not shown.
|
Before Width: | Height: | Size: 1.5 MiB After Width: | Height: | Size: 1.6 MiB |
@ -1,3 +1,4 @@
|
|||||||
|
SHELL=/usr/bin/env bash
|
||||||
SED ?= $(shell which gsed 2>/dev/null || which sed)
|
SED ?= $(shell which gsed 2>/dev/null || which sed)
|
||||||
|
|
||||||
MKDOCS_PAGES=$(shell cd ../mkdocs/docs/ && find * -type f -name '*.md' | sort)
|
MKDOCS_PAGES=$(shell cd ../mkdocs/docs/ && find * -type f -name '*.md' | sort)
|
||||||
|
|||||||
@ -128,6 +128,8 @@ INSERT INTO searchIndex(name, type, path) VALUES ('json_pointer', 'Class', 'api/
|
|||||||
INSERT INTO searchIndex(name, type, path) VALUES ('json_pointer::back', 'Method', 'api/json_pointer/back/index.html');
|
INSERT INTO searchIndex(name, type, path) VALUES ('json_pointer::back', 'Method', 'api/json_pointer/back/index.html');
|
||||||
INSERT INTO searchIndex(name, type, path) VALUES ('json_pointer::empty', 'Method', 'api/json_pointer/empty/index.html');
|
INSERT INTO searchIndex(name, type, path) VALUES ('json_pointer::empty', 'Method', 'api/json_pointer/empty/index.html');
|
||||||
INSERT INTO searchIndex(name, type, path) VALUES ('json_pointer::json_pointer', 'Constructor', 'api/json_pointer/json_pointer/index.html');
|
INSERT INTO searchIndex(name, type, path) VALUES ('json_pointer::json_pointer', 'Constructor', 'api/json_pointer/json_pointer/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('json_pointer::operator==', 'Operator', 'api/json_pointer/operator_eq/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('json_pointer::operator!=', 'Operator', 'api/json_pointer/operator_ne/index.html');
|
||||||
INSERT INTO searchIndex(name, type, path) VALUES ('json_pointer::operator/', 'Operator', 'api/json_pointer/operator_slash/index.html');
|
INSERT INTO searchIndex(name, type, path) VALUES ('json_pointer::operator/', 'Operator', 'api/json_pointer/operator_slash/index.html');
|
||||||
INSERT INTO searchIndex(name, type, path) VALUES ('json_pointer::operator/=', 'Operator', 'api/json_pointer/operator_slasheq/index.html');
|
INSERT INTO searchIndex(name, type, path) VALUES ('json_pointer::operator/=', 'Operator', 'api/json_pointer/operator_slasheq/index.html');
|
||||||
INSERT INTO searchIndex(name, type, path) VALUES ('json_pointer::operator string_t', 'Operator', 'api/json_pointer/operator_string_t/index.html');
|
INSERT INTO searchIndex(name, type, path) VALUES ('json_pointer::operator string_t', 'Operator', 'api/json_pointer/operator_string_t/index.html');
|
||||||
@ -181,6 +183,7 @@ INSERT INTO searchIndex(name, type, path) VALUES ('Iterators', 'Guide', 'feature
|
|||||||
INSERT INTO searchIndex(name, type, path) VALUES ('JSON Merge Patch', 'Guide', 'features/merge_patch/index.html');
|
INSERT INTO searchIndex(name, type, path) VALUES ('JSON Merge Patch', 'Guide', 'features/merge_patch/index.html');
|
||||||
INSERT INTO searchIndex(name, type, path) VALUES ('JSON Patch and Diff', 'Guide', 'features/json_patch/index.html');
|
INSERT INTO searchIndex(name, type, path) VALUES ('JSON Patch and Diff', 'Guide', 'features/json_patch/index.html');
|
||||||
INSERT INTO searchIndex(name, type, path) VALUES ('JSON Pointer', 'Guide', 'features/json_pointer/index.html');
|
INSERT INTO searchIndex(name, type, path) VALUES ('JSON Pointer', 'Guide', 'features/json_pointer/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('nlohmann Namespace', 'Guide', 'features/namespace/index.html');
|
||||||
INSERT INTO searchIndex(name, type, path) VALUES ('Types', 'Guide', 'features/types/index.html');
|
INSERT INTO searchIndex(name, type, path) VALUES ('Types', 'Guide', 'features/types/index.html');
|
||||||
INSERT INTO searchIndex(name, type, path) VALUES ('Types: Number Handling', 'Guide', 'features/types/number_handling/index.html');
|
INSERT INTO searchIndex(name, type, path) VALUES ('Types: Number Handling', 'Guide', 'features/types/number_handling/index.html');
|
||||||
INSERT INTO searchIndex(name, type, path) VALUES ('Object Order', 'Guide', 'features/object_order/index.html');
|
INSERT INTO searchIndex(name, type, path) VALUES ('Object Order', 'Guide', 'features/object_order/index.html');
|
||||||
@ -223,6 +226,7 @@ INSERT INTO searchIndex(name, type, path) VALUES ('NLOHMANN_DEFINE_TYPE_NON_INTR
|
|||||||
INSERT INTO searchIndex(name, type, path) VALUES ('NLOHMANN_JSON_NAMESPACE', 'Macro', 'api/macros/nlohmann_json_namespace/index.html');
|
INSERT INTO searchIndex(name, type, path) VALUES ('NLOHMANN_JSON_NAMESPACE', 'Macro', 'api/macros/nlohmann_json_namespace/index.html');
|
||||||
INSERT INTO searchIndex(name, type, path) VALUES ('NLOHMANN_JSON_NAMESPACE_BEGIN', 'Macro', 'api/macros/nlohmann_json_namespace_begin/index.html');
|
INSERT INTO searchIndex(name, type, path) VALUES ('NLOHMANN_JSON_NAMESPACE_BEGIN', 'Macro', 'api/macros/nlohmann_json_namespace_begin/index.html');
|
||||||
INSERT INTO searchIndex(name, type, path) VALUES ('NLOHMANN_JSON_NAMESPACE_END', 'Macro', 'api/macros/nlohmann_json_namespace_begin/index.html');
|
INSERT INTO searchIndex(name, type, path) VALUES ('NLOHMANN_JSON_NAMESPACE_END', 'Macro', 'api/macros/nlohmann_json_namespace_begin/index.html');
|
||||||
|
INSERT INTO searchIndex(name, type, path) VALUES ('NLOHMANN_JSON_NAMESPACE_NO_VERSION', 'Macro', 'api/macros/nlohmann_json_namespace_no_version/index.html');
|
||||||
INSERT INTO searchIndex(name, type, path) VALUES ('NLOHMANN_JSON_SERIALIZE_ENUM', 'Macro', 'api/macros/nlohmann_json_serialize_enum/index.html');
|
INSERT INTO searchIndex(name, type, path) VALUES ('NLOHMANN_JSON_SERIALIZE_ENUM', 'Macro', 'api/macros/nlohmann_json_serialize_enum/index.html');
|
||||||
INSERT INTO searchIndex(name, type, path) VALUES ('NLOHMANN_JSON_VERSION_MAJOR', 'Macro', 'api/macros/nlohmann_json_version_major/index.html');
|
INSERT INTO searchIndex(name, type, path) VALUES ('NLOHMANN_JSON_VERSION_MAJOR', 'Macro', 'api/macros/nlohmann_json_version_major/index.html');
|
||||||
INSERT INTO searchIndex(name, type, path) VALUES ('NLOHMANN_JSON_VERSION_MINOR', 'Macro', 'api/macros/nlohmann_json_version_major/index.html');
|
INSERT INTO searchIndex(name, type, path) VALUES ('NLOHMANN_JSON_VERSION_MINOR', 'Macro', 'api/macros/nlohmann_json_version_major/index.html');
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "JSON for Modern C++",
|
"name": "JSON for Modern C++",
|
||||||
"version": "3.11.1",
|
"version": "3.11.2",
|
||||||
"archive": "JSON_for_Modern_C++.tgz",
|
"archive": "JSON_for_Modern_C++.tgz",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Niels Lohmann",
|
"name": "Niels Lohmann",
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
{"one":1,"three":3,"two":2}
|
{"one":1,"three":3,"two":2}
|
||||||
{"one":1.2,"three":3.4,"two":2.3}
|
{"one":1.2,"three":3.4,"two":2.3}
|
||||||
{"one":true,"three":false,"two":true}
|
{"one":true,"three":false,"two":true}
|
||||||
{"one":true,"three":true,"two":true}
|
{"one":true,"three":false,"two":true}
|
||||||
|
|
||||||
["one","two",3,4.5,false]
|
["one","two",3,4.5,false]
|
||||||
[1,2,3,4]
|
[1,2,3,4]
|
||||||
|
|||||||
37
docs/examples/from_json__default_constructible.cpp
Normal file
37
docs/examples/from_json__default_constructible.cpp
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
#include <iostream>
|
||||||
|
#include <nlohmann/json.hpp>
|
||||||
|
|
||||||
|
using json = nlohmann::json;
|
||||||
|
|
||||||
|
namespace ns
|
||||||
|
{
|
||||||
|
// a simple struct to model a person
|
||||||
|
struct person
|
||||||
|
{
|
||||||
|
std::string name;
|
||||||
|
std::string address;
|
||||||
|
int age;
|
||||||
|
};
|
||||||
|
} // namespace ns
|
||||||
|
|
||||||
|
namespace ns
|
||||||
|
{
|
||||||
|
void from_json(const json& j, person& p)
|
||||||
|
{
|
||||||
|
j.at("name").get_to(p.name);
|
||||||
|
j.at("address").get_to(p.address);
|
||||||
|
j.at("age").get_to(p.age);
|
||||||
|
}
|
||||||
|
} // namespace ns
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
json j;
|
||||||
|
j["name"] = "Ned Flanders";
|
||||||
|
j["address"] = "744 Evergreen Terrace";
|
||||||
|
j["age"] = 60;
|
||||||
|
|
||||||
|
auto p = j.get<ns::person>();
|
||||||
|
|
||||||
|
std::cout << p.name << " (" << p.age << ") lives in " << p.address << std::endl;
|
||||||
|
}
|
||||||
1
docs/examples/from_json__default_constructible.output
Normal file
1
docs/examples/from_json__default_constructible.output
Normal file
@ -0,0 +1 @@
|
|||||||
|
Ned Flanders (60) lives in 744 Evergreen Terrace
|
||||||
53
docs/examples/from_json__non_default_constructible.cpp
Normal file
53
docs/examples/from_json__non_default_constructible.cpp
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
#include <iostream>
|
||||||
|
#include <nlohmann/json.hpp>
|
||||||
|
|
||||||
|
using json = nlohmann::json;
|
||||||
|
|
||||||
|
namespace ns
|
||||||
|
{
|
||||||
|
// a simple struct to model a person (not default constructible)
|
||||||
|
struct person
|
||||||
|
{
|
||||||
|
person(std::string n, std::string a, int aa)
|
||||||
|
: name(std::move(n)), address(std::move(a)), age(aa)
|
||||||
|
{}
|
||||||
|
|
||||||
|
std::string name;
|
||||||
|
std::string address;
|
||||||
|
int age;
|
||||||
|
};
|
||||||
|
} // namespace ns
|
||||||
|
|
||||||
|
namespace nlohmann
|
||||||
|
{
|
||||||
|
template <>
|
||||||
|
struct adl_serializer<ns::person>
|
||||||
|
{
|
||||||
|
static ns::person from_json(const json& j)
|
||||||
|
{
|
||||||
|
return {j.at("name"), j.at("address"), j.at("age")};
|
||||||
|
}
|
||||||
|
|
||||||
|
// Here's the catch! You must provide a to_json method! Otherwise, you
|
||||||
|
// will not be able to convert person to json, since you fully
|
||||||
|
// specialized adl_serializer on that type
|
||||||
|
static void to_json(json& j, ns::person p)
|
||||||
|
{
|
||||||
|
j["name"] = p.name;
|
||||||
|
j["address"] = p.address;
|
||||||
|
j["age"] = p.age;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
} // namespace nlohmann
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
json j;
|
||||||
|
j["name"] = "Ned Flanders";
|
||||||
|
j["address"] = "744 Evergreen Terrace";
|
||||||
|
j["age"] = 60;
|
||||||
|
|
||||||
|
auto p = j.get<ns::person>();
|
||||||
|
|
||||||
|
std::cout << p.name << " (" << p.age << ") lives in " << p.address << std::endl;
|
||||||
|
}
|
||||||
@ -0,0 +1 @@
|
|||||||
|
Ned Flanders (60) lives in 744 Evergreen Terrace
|
||||||
19
docs/examples/json_pointer__operator__equal.cpp
Normal file
19
docs/examples/json_pointer__operator__equal.cpp
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
#include <iostream>
|
||||||
|
#include <nlohmann/json.hpp>
|
||||||
|
|
||||||
|
using json = nlohmann::json;
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
// different JSON pointers
|
||||||
|
json::json_pointer ptr0;
|
||||||
|
json::json_pointer ptr1("");
|
||||||
|
json::json_pointer ptr2("/foo");
|
||||||
|
|
||||||
|
// compare JSON pointers
|
||||||
|
std::cout << std::boolalpha
|
||||||
|
<< "\"" << ptr0 << "\" == \"" << ptr0 << "\": " << (ptr0 == ptr0) << '\n'
|
||||||
|
<< "\"" << ptr0 << "\" == \"" << ptr1 << "\": " << (ptr0 == ptr1) << '\n'
|
||||||
|
<< "\"" << ptr1 << "\" == \"" << ptr2 << "\": " << (ptr1 == ptr2) << '\n'
|
||||||
|
<< "\"" << ptr2 << "\" == \"" << ptr2 << "\": " << (ptr2 == ptr2) << std::endl;
|
||||||
|
}
|
||||||
4
docs/examples/json_pointer__operator__equal.output
Normal file
4
docs/examples/json_pointer__operator__equal.output
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
"" == "": true
|
||||||
|
"" == "": true
|
||||||
|
"" == "/foo": false
|
||||||
|
"/foo" == "/foo": true
|
||||||
33
docs/examples/json_pointer__operator__equal_stringtype.cpp
Normal file
33
docs/examples/json_pointer__operator__equal_stringtype.cpp
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
#include <exception>
|
||||||
|
#include <iostream>
|
||||||
|
#include <nlohmann/json.hpp>
|
||||||
|
|
||||||
|
using json = nlohmann::json;
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
// different JSON pointers
|
||||||
|
json::json_pointer ptr0;
|
||||||
|
json::json_pointer ptr1("");
|
||||||
|
json::json_pointer ptr2("/foo");
|
||||||
|
|
||||||
|
// different strings
|
||||||
|
std::string str0("");
|
||||||
|
std::string str1("/foo");
|
||||||
|
std::string str2("bar");
|
||||||
|
|
||||||
|
// compare JSON pointers and strings
|
||||||
|
std::cout << std::boolalpha
|
||||||
|
<< "\"" << ptr0 << "\" == \"" << str0 << "\": " << (ptr0 == str0) << '\n'
|
||||||
|
<< "\"" << str0 << "\" == \"" << ptr1 << "\": " << (str0 == ptr1) << '\n'
|
||||||
|
<< "\"" << ptr2 << "\" == \"" << str1 << "\": " << (ptr2 == str1) << std::endl;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
std::cout << "\"" << str2 << "\" == \"" << ptr2 << "\": " << (str2 == ptr2) << std::endl;
|
||||||
|
}
|
||||||
|
catch (const json::parse_error& ex)
|
||||||
|
{
|
||||||
|
std::cout << ex.what() << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,4 @@
|
|||||||
|
"" == "": true
|
||||||
|
"" == "": true
|
||||||
|
"/foo" == "/foo": true
|
||||||
|
"bar" == "/foo": [json.exception.parse_error.107] parse error at byte 1: JSON pointer must be empty or begin with '/' - was: 'bar'
|
||||||
19
docs/examples/json_pointer__operator__notequal.cpp
Normal file
19
docs/examples/json_pointer__operator__notequal.cpp
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
#include <iostream>
|
||||||
|
#include <nlohmann/json.hpp>
|
||||||
|
|
||||||
|
using json = nlohmann::json;
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
// different JSON pointers
|
||||||
|
json::json_pointer ptr0;
|
||||||
|
json::json_pointer ptr1("");
|
||||||
|
json::json_pointer ptr2("/foo");
|
||||||
|
|
||||||
|
// compare JSON pointers
|
||||||
|
std::cout << std::boolalpha
|
||||||
|
<< "\"" << ptr0 << "\" != \"" << ptr0 << "\": " << (ptr0 != ptr0) << '\n'
|
||||||
|
<< "\"" << ptr0 << "\" != \"" << ptr1 << "\": " << (ptr0 != ptr1) << '\n'
|
||||||
|
<< "\"" << ptr1 << "\" != \"" << ptr2 << "\": " << (ptr1 != ptr2) << '\n'
|
||||||
|
<< "\"" << ptr2 << "\" != \"" << ptr2 << "\": " << (ptr2 != ptr2) << std::endl;
|
||||||
|
}
|
||||||
4
docs/examples/json_pointer__operator__notequal.output
Normal file
4
docs/examples/json_pointer__operator__notequal.output
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
"" != "": false
|
||||||
|
"" != "": false
|
||||||
|
"" != "/foo": true
|
||||||
|
"/foo" != "/foo": false
|
||||||
@ -0,0 +1,32 @@
|
|||||||
|
#include <iostream>
|
||||||
|
#include <nlohmann/json.hpp>
|
||||||
|
|
||||||
|
using json = nlohmann::json;
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
// different JSON pointers
|
||||||
|
json::json_pointer ptr0;
|
||||||
|
json::json_pointer ptr1("");
|
||||||
|
json::json_pointer ptr2("/foo");
|
||||||
|
|
||||||
|
// different strings
|
||||||
|
std::string str0("");
|
||||||
|
std::string str1("/foo");
|
||||||
|
std::string str2("bar");
|
||||||
|
|
||||||
|
// compare JSON pointers and strings
|
||||||
|
std::cout << std::boolalpha
|
||||||
|
<< "\"" << ptr0 << "\" != \"" << str0 << "\": " << (ptr0 != str0) << '\n'
|
||||||
|
<< "\"" << str0 << "\" != \"" << ptr1 << "\": " << (str0 != ptr1) << '\n'
|
||||||
|
<< "\"" << ptr2 << "\" != \"" << str1 << "\": " << (ptr2 != str1) << std::endl;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
std::cout << "\"" << str2 << "\" != \"" << ptr2 << "\": " << (str2 != ptr2) << std::endl;
|
||||||
|
}
|
||||||
|
catch (const json::parse_error& ex)
|
||||||
|
{
|
||||||
|
std::cout << ex.what() << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,4 @@
|
|||||||
|
"" != "": false
|
||||||
|
"" != "": false
|
||||||
|
"/foo" != "/foo": false
|
||||||
|
"bar" != "/foo": [json.exception.parse_error.107] parse error at byte 1: JSON pointer must be empty or begin with '/' - was: 'bar'
|
||||||
@ -2,7 +2,7 @@
|
|||||||
"compiler": {
|
"compiler": {
|
||||||
"c++": "201103",
|
"c++": "201103",
|
||||||
"family": "gcc",
|
"family": "gcc",
|
||||||
"version": "11.3.0"
|
"version": "12.1.0"
|
||||||
},
|
},
|
||||||
"copyright": "(C) 2013-2022 Niels Lohmann",
|
"copyright": "(C) 2013-2022 Niels Lohmann",
|
||||||
"name": "JSON for Modern C++",
|
"name": "JSON for Modern C++",
|
||||||
@ -11,7 +11,7 @@
|
|||||||
"version": {
|
"version": {
|
||||||
"major": 3,
|
"major": 3,
|
||||||
"minor": 11,
|
"minor": 11,
|
||||||
"patch": 1,
|
"patch": 2,
|
||||||
"string": "3.11.1"
|
"string": "3.11.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
14
docs/examples/nlohmann_json_namespace.cpp
Normal file
14
docs/examples/nlohmann_json_namespace.cpp
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#include <iostream>
|
||||||
|
#include <nlohmann/json.hpp>
|
||||||
|
|
||||||
|
// possible use case: use NLOHMANN_JSON_NAMESPACE instead of nlohmann
|
||||||
|
using json = NLOHMANN_JSON_NAMESPACE::json;
|
||||||
|
|
||||||
|
// macro needed to output the NLOHMANN_JSON_NAMESPACE as string literal
|
||||||
|
#define Q(x) #x
|
||||||
|
#define QUOTE(x) Q(x)
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
std::cout << QUOTE(NLOHMANN_JSON_NAMESPACE) << std::endl;
|
||||||
|
}
|
||||||
1
docs/examples/nlohmann_json_namespace.output
Normal file
1
docs/examples/nlohmann_json_namespace.output
Normal file
@ -0,0 +1 @@
|
|||||||
|
nlohmann::json_abi_v3_11_2
|
||||||
33
docs/examples/nlohmann_json_namespace_begin.c++17.cpp
Normal file
33
docs/examples/nlohmann_json_namespace_begin.c++17.cpp
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
#include <iostream>
|
||||||
|
#include <optional>
|
||||||
|
#include <nlohmann/json.hpp>
|
||||||
|
|
||||||
|
// partial specialization (see https://json.nlohmann.me/features/arbitrary_types/)
|
||||||
|
NLOHMANN_JSON_NAMESPACE_BEGIN
|
||||||
|
template <typename T>
|
||||||
|
struct adl_serializer<std::optional<T>>
|
||||||
|
{
|
||||||
|
static void to_json(json& j, const std::optional<T>& opt)
|
||||||
|
{
|
||||||
|
if (opt == std::nullopt)
|
||||||
|
{
|
||||||
|
j = nullptr;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
j = *opt;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
NLOHMANN_JSON_NAMESPACE_END
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
std::optional<int> o1 = 1;
|
||||||
|
std::optional<int> o2 = std::nullopt;
|
||||||
|
|
||||||
|
NLOHMANN_JSON_NAMESPACE::json j;
|
||||||
|
j.push_back(o1);
|
||||||
|
j.push_back(o2);
|
||||||
|
std::cout << j << std::endl;
|
||||||
|
}
|
||||||
1
docs/examples/nlohmann_json_namespace_begin.c++17.output
Normal file
1
docs/examples/nlohmann_json_namespace_begin.c++17.output
Normal file
@ -0,0 +1 @@
|
|||||||
|
[1,null]
|
||||||
13
docs/examples/nlohmann_json_namespace_no_version.cpp
Normal file
13
docs/examples/nlohmann_json_namespace_no_version.cpp
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
#define NLOHMANN_JSON_NAMESPACE_NO_VERSION 1
|
||||||
|
#include <nlohmann/json.hpp>
|
||||||
|
|
||||||
|
// macro needed to output the NLOHMANN_JSON_NAMESPACE as string literal
|
||||||
|
#define Q(x) #x
|
||||||
|
#define QUOTE(x) Q(x)
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
std::cout << QUOTE(NLOHMANN_JSON_NAMESPACE) << std::endl;
|
||||||
|
}
|
||||||
1
docs/examples/nlohmann_json_namespace_no_version.output
Normal file
1
docs/examples/nlohmann_json_namespace_no_version.output
Normal file
@ -0,0 +1 @@
|
|||||||
|
nlohmann::json_abi
|
||||||
@ -1 +1 @@
|
|||||||
JSON for Modern C++ version 3.11.1
|
JSON for Modern C++ version 3.11.2
|
||||||
|
|||||||
32
docs/examples/to_json.cpp
Normal file
32
docs/examples/to_json.cpp
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
#include <iostream>
|
||||||
|
#include <nlohmann/json.hpp>
|
||||||
|
|
||||||
|
using json = nlohmann::json;
|
||||||
|
|
||||||
|
namespace ns
|
||||||
|
{
|
||||||
|
// a simple struct to model a person
|
||||||
|
struct person
|
||||||
|
{
|
||||||
|
std::string name;
|
||||||
|
std::string address;
|
||||||
|
int age;
|
||||||
|
};
|
||||||
|
} // namespace ns
|
||||||
|
|
||||||
|
namespace ns
|
||||||
|
{
|
||||||
|
void to_json(json& j, const person& p)
|
||||||
|
{
|
||||||
|
j = json{ {"name", p.name}, {"address", p.address}, {"age", p.age} };
|
||||||
|
}
|
||||||
|
} // namespace ns
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
ns::person p = {"Ned Flanders", "744 Evergreen Terrace", 60};
|
||||||
|
|
||||||
|
json j = p;
|
||||||
|
|
||||||
|
std::cout << j << std::endl;
|
||||||
|
}
|
||||||
1
docs/examples/to_json.output
Normal file
1
docs/examples/to_json.output
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"address":"744 Evergreen Terrace","age":60,"name":"Ned Flanders"}
|
||||||
BIN
docs/json.gif
BIN
docs/json.gif
Binary file not shown.
|
Before Width: | Height: | Size: 1.6 MiB After Width: | Height: | Size: 1.6 MiB |
@ -28,6 +28,7 @@ publish: prepare_files
|
|||||||
# install a Python virtual environment
|
# install a Python virtual environment
|
||||||
install_venv: requirements.txt
|
install_venv: requirements.txt
|
||||||
python3 -mvenv venv
|
python3 -mvenv venv
|
||||||
|
venv/bin/pip install --upgrade pip
|
||||||
venv/bin/pip install wheel
|
venv/bin/pip install wheel
|
||||||
venv/bin/pip install -r requirements.txt
|
venv/bin/pip install -r requirements.txt
|
||||||
|
|
||||||
|
|||||||
@ -14,8 +14,8 @@ noexcept(::nlohmann::from_json(std::forward<BasicJsonType>(j), detail::identity_
|
|||||||
-> decltype(::nlohmann::from_json(std::forward<BasicJsonType>(j), detail::identity_tag<TargetType> {}))
|
-> decltype(::nlohmann::from_json(std::forward<BasicJsonType>(j), detail::identity_tag<TargetType> {}))
|
||||||
```
|
```
|
||||||
|
|
||||||
This function is usually called by the [`get()`](../basic_json/get.md) function of the
|
This function is usually called by the [`get()`](../basic_json/get.md) function of the [basic_json](../basic_json)
|
||||||
[basic_json](../basic_json) class (either explicit or via conversion operators).
|
class (either explicitly or via the conversion operators).
|
||||||
|
|
||||||
1. This function is chosen for default-constructible value types.
|
1. This function is chosen for default-constructible value types.
|
||||||
2. This function is chosen for value types which are not default-constructible.
|
2. This function is chosen for value types which are not default-constructible.
|
||||||
@ -32,9 +32,41 @@ This function is usually called by the [`get()`](../basic_json/get.md) function
|
|||||||
|
|
||||||
Copy of the JSON value, converted to `ValueType`
|
Copy of the JSON value, converted to `ValueType`
|
||||||
|
|
||||||
!!! note
|
## Examples
|
||||||
|
|
||||||
This documentation page is a stub.
|
??? example "Example: (1) Default-constructible type"
|
||||||
|
|
||||||
|
The example below shows how a `from_json` function can be implemented for a user-defined type. This function is
|
||||||
|
called by the `adl_serializer` when `get<ns::person>()` is called.
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
--8<-- "examples/from_json__default_constructible.cpp"
|
||||||
|
```
|
||||||
|
|
||||||
|
Output:
|
||||||
|
|
||||||
|
```json
|
||||||
|
--8<-- "examples/from_json__default_constructible.output"
|
||||||
|
```
|
||||||
|
|
||||||
|
??? example "Example: (2) Non-default-constructible type"
|
||||||
|
|
||||||
|
The example below shows how a `from_json` is implemented as part of a specialization of the `adl_serializer` to
|
||||||
|
realize the conversion of a non-default-constructible type.
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
--8<-- "examples/from_json__non_default_constructible.cpp"
|
||||||
|
```
|
||||||
|
|
||||||
|
Output:
|
||||||
|
|
||||||
|
```json
|
||||||
|
--8<-- "examples/from_json__non_default_constructible.output"
|
||||||
|
```
|
||||||
|
|
||||||
|
## See also
|
||||||
|
|
||||||
|
- [to_json](to_json.md)
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
|
|||||||
@ -17,9 +17,26 @@ This function is usually called by the constructors of the [basic_json](../basic
|
|||||||
`val` (in)
|
`val` (in)
|
||||||
: value to read from
|
: value to read from
|
||||||
|
|
||||||
!!! note
|
## Examples
|
||||||
|
|
||||||
This documentation page is a stub.
|
??? example
|
||||||
|
|
||||||
|
The example below shows how a `to_json` function can be implemented for a user-defined type. This function is called
|
||||||
|
by the `adl_serializer` when the constructor `basic_json(ns::person)` is called.
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
--8<-- "examples/to_json.cpp"
|
||||||
|
```
|
||||||
|
|
||||||
|
Output:
|
||||||
|
|
||||||
|
```json
|
||||||
|
--8<-- "examples/to_json.output"
|
||||||
|
```
|
||||||
|
|
||||||
|
## See also
|
||||||
|
|
||||||
|
- [from_json](from_json.md)
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
|
|||||||
@ -6,8 +6,8 @@ using boolean_t = BooleanType;
|
|||||||
|
|
||||||
The type used to store JSON booleans.
|
The type used to store JSON booleans.
|
||||||
|
|
||||||
[RFC 8259](https://tools.ietf.org/html/rfc8259) implicitly describes a boolean as a type which differentiates the two literals
|
[RFC 8259](https://tools.ietf.org/html/rfc8259) implicitly describes a boolean as a type which differentiates the two
|
||||||
`#!json true` and `#!json false`.
|
literals `#!json true` and `#!json false`.
|
||||||
|
|
||||||
To store objects in C++, a type is defined by the template parameter `BooleanType` which chooses the type to use.
|
To store objects in C++, a type is defined by the template parameter `BooleanType` which chooses the type to use.
|
||||||
|
|
||||||
|
|||||||
@ -19,6 +19,23 @@ using json_serializer = JSONSerializer<T, SFINAE>;
|
|||||||
|
|
||||||
The default values for `json_serializer` is [`adl_serializer`](../adl_serializer).
|
The default values for `json_serializer` is [`adl_serializer`](../adl_serializer).
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
??? example
|
||||||
|
|
||||||
|
The example below shows how a conversion of a non-default-constructible type is implemented via a specialization of
|
||||||
|
the `adl_serializer`.
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
--8<-- "examples/from_json__non_default_constructible.cpp"
|
||||||
|
```
|
||||||
|
|
||||||
|
Output:
|
||||||
|
|
||||||
|
```json
|
||||||
|
--8<-- "examples/from_json__non_default_constructible.output"
|
||||||
|
```
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
- Since version 2.0.0.
|
- Since version 2.0.0.
|
||||||
|
|||||||
@ -28,4 +28,5 @@ and [`default_object_comparator_t`](default_object_comparator_t.md) otherwise.
|
|||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
- Added in version 3.0.0.
|
- Added in version 3.0.0.
|
||||||
- Changed to be conditionally defined as `#!cpp typename object_t::key_compare` or `default_object_comparator_t` in version 3.11.0.
|
- Changed to be conditionally defined as `#!cpp typename object_t::key_compare` or `default_object_comparator_t` in
|
||||||
|
version 3.11.0.
|
||||||
|
|||||||
@ -90,7 +90,8 @@ Objects are stored as pointers in a `basic_json` type. That is, for any access t
|
|||||||
The order name/value pairs are added to the object is *not* preserved by the library. Therefore, iterating an object may
|
The order name/value pairs are added to the object is *not* preserved by the library. Therefore, iterating an object may
|
||||||
return name/value pairs in a different order than they were originally stored. In fact, keys will be traversed in
|
return name/value pairs in a different order than they were originally stored. In fact, keys will be traversed in
|
||||||
alphabetical order as `std::map` with `std::less` is used by default. Please note this behavior conforms to
|
alphabetical order as `std::map` with `std::less` is used by default. Please note this behavior conforms to
|
||||||
[RFC 8259](https://tools.ietf.org/html/rfc8259), because any order implements the specified "unordered" nature of JSON objects.
|
[RFC 8259](https://tools.ietf.org/html/rfc8259), because any order implements the specified "unordered" nature of JSON
|
||||||
|
objects.
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
|
|||||||
@ -21,7 +21,8 @@ const_reference operator[](const json_pointer& ptr) const;
|
|||||||
```
|
```
|
||||||
|
|
||||||
1. Returns a reference to the array element at specified location `idx`.
|
1. Returns a reference to the array element at specified location `idx`.
|
||||||
2. Returns a reference to the object element with specified key `key`. The non-const qualified overload takes the key by value.
|
2. Returns a reference to the object element with specified key `key`. The non-const qualified overload takes the key by
|
||||||
|
value.
|
||||||
3. See 2. This overload is only available if `KeyType` is comparable with `#!cpp typename object_t::key_type` and
|
3. See 2. This overload is only available if `KeyType` is comparable with `#!cpp typename object_t::key_type` and
|
||||||
`#!cpp typename object_comparator_t::is_transparent` denotes a type.
|
`#!cpp typename object_comparator_t::is_transparent` denotes a type.
|
||||||
4. Returns a reference to the element with specified JSON pointer `ptr`.
|
4. Returns a reference to the element with specified JSON pointer `ptr`.
|
||||||
@ -234,6 +235,7 @@ Strong exception safety: if an exception occurs, the original value stays intact
|
|||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
1. Added in version 1.0.0.
|
1. Added in version 1.0.0.
|
||||||
2. Added in version 1.0.0. Added overloads for `T* key` in version 1.1.0. Removed overloads for `T* key` (replaced by 3) in version 3.11.0.
|
2. Added in version 1.0.0. Added overloads for `T* key` in version 1.1.0. Removed overloads for `T* key` (replaced by 3)
|
||||||
|
in version 3.11.0.
|
||||||
3. Added in version 3.11.0.
|
3. Added in version 3.11.0.
|
||||||
4. Added in version 2.0.0.
|
4. Added in version 2.0.0.
|
||||||
|
|||||||
@ -20,8 +20,8 @@ class basic_json {
|
|||||||
```
|
```
|
||||||
|
|
||||||
1. Compares two JSON values for equality according to the following rules:
|
1. Compares two JSON values for equality according to the following rules:
|
||||||
- Two JSON values are equal if (1) neither value is discarded, or (2) they are of the same
|
- Two JSON values are equal if (1) neither value is discarded, or (2) they are of the same type and their stored
|
||||||
type and their stored values are the same according to their respective `operator==`.
|
values are the same according to their respective `operator==`.
|
||||||
- Integer and floating-point numbers are automatically converted before comparison.
|
- Integer and floating-point numbers are automatically converted before comparison.
|
||||||
|
|
||||||
2. Compares a JSON value and a scalar or a scalar and a JSON value for equality by converting the
|
2. Compares a JSON value and a scalar or a scalar and a JSON value for equality by converting the
|
||||||
|
|||||||
@ -11,15 +11,14 @@ template<typename ScalarType>
|
|||||||
bool operator>=(ScalarType lhs, const const_reference rhs) noexcept; // (2)
|
bool operator>=(ScalarType lhs, const const_reference rhs) noexcept; // (2)
|
||||||
```
|
```
|
||||||
|
|
||||||
1. Compares whether one JSON value `lhs` is greater than or equal to another JSON value `rhs`
|
1. Compares whether one JSON value `lhs` is greater than or equal to another JSON value `rhs` according to the following
|
||||||
according to the following rules:
|
rules:
|
||||||
- The comparison always yields `#!cpp false` if (1) either operand is discarded, or (2) either
|
- The comparison always yields `#!cpp false` if (1) either operand is discarded, or (2) either operand is `NaN` and
|
||||||
operand is `NaN` and the other operand is either `NaN` or any other number.
|
the other operand is either `NaN` or any other number.
|
||||||
- Otherwise, returns the result of `#!cpp !(lhs < rhs)` (see [**operator<**](operator_lt.md)).
|
- Otherwise, returns the result of `#!cpp !(lhs < rhs)` (see [**operator<**](operator_lt.md)).
|
||||||
|
|
||||||
2. Compares wether a JSON value is greater than or equal to a scalar or a scalar is greater than or
|
2. Compares whether a JSON value is greater than or equal to a scalar or a scalar is greater than or equal to a JSON
|
||||||
equal to a JSON value by converting the scalar to a JSON value and comparing both JSON values
|
value by converting the scalar to a JSON value and comparing both JSON values according to 1.
|
||||||
according to 1.
|
|
||||||
|
|
||||||
## Template parameters
|
## Template parameters
|
||||||
|
|
||||||
|
|||||||
@ -20,13 +20,12 @@ class basic_json {
|
|||||||
```
|
```
|
||||||
|
|
||||||
1. Compares two JSON values for inequality according to the following rules:
|
1. Compares two JSON values for inequality according to the following rules:
|
||||||
- The comparison always yields `#!cpp false` if (1) either operand is discarded, or (2) either
|
- The comparison always yields `#!cpp false` if (1) either operand is discarded, or (2) either operand is `NaN` and
|
||||||
operand is `NaN` and the other operand is either `NaN` or any other number.
|
the other operand is either `NaN` or any other number.
|
||||||
- Otherwise, returns the result of `#!cpp !(lhs == rhs)` (until C++20) or
|
- Otherwise, returns the result of `#!cpp !(lhs == rhs)` (until C++20) or `#!cpp !(*this == rhs)` (since C++20).
|
||||||
`#!cpp !(*this == rhs)` (since C++20).
|
|
||||||
|
|
||||||
2. Compares a JSON value and a scalar or a scalar and a JSON value for inequality by converting the
|
2. Compares a JSON value and a scalar or a scalar and a JSON value for inequality by converting the scalar to a JSON
|
||||||
scalar to a JSON value and comparing both JSON values according to 1.
|
value and comparing both JSON values according to 1.
|
||||||
|
|
||||||
## Template parameters
|
## Template parameters
|
||||||
|
|
||||||
|
|||||||
@ -12,16 +12,16 @@ class basic_json {
|
|||||||
|
|
||||||
1. 3-way compares two JSON values producing a result of type `std::partial_ordering` according to the following rules:
|
1. 3-way compares two JSON values producing a result of type `std::partial_ordering` according to the following rules:
|
||||||
- Two JSON values compare with a result of `std::partial_ordering::unordered` if either value is discarded.
|
- Two JSON values compare with a result of `std::partial_ordering::unordered` if either value is discarded.
|
||||||
- If both JSON values are of the same type, the result is produced by 3-way comparing their stored values using their
|
- If both JSON values are of the same type, the result is produced by 3-way comparing their stored values using
|
||||||
|
their respective `operator<=>`.
|
||||||
|
- Integer and floating-point numbers are converted to their common type and then 3-way compared using their
|
||||||
respective `operator<=>`.
|
respective `operator<=>`.
|
||||||
- Integer and floating-point numbers are converted to their common type and then 3-way compared using their respective
|
For instance, comparing an integer and a floating-point value will 3-way compare the first value converted to
|
||||||
`operator<=>`.
|
|
||||||
For instance, comparing an integer and a floating-point value will 3-way compare the first value convertered to
|
|
||||||
floating-point with the second value.
|
floating-point with the second value.
|
||||||
- Otherwise, yields a result by comparing the type (see [`value_t`](value_t.md)).
|
- Otherwise, yields a result by comparing the type (see [`value_t`](value_t.md)).
|
||||||
|
|
||||||
2. 3-way compares a JSON value and a scalar or a scalar and a JSON value by converting the scalar to a JSON value and 3-way
|
2. 3-way compares a JSON value and a scalar or a scalar and a JSON value by converting the scalar to a JSON value and
|
||||||
comparing both JSON values (see 1).
|
3-way comparing both JSON values (see 1).
|
||||||
|
|
||||||
## Template parameters
|
## Template parameters
|
||||||
|
|
||||||
|
|||||||
@ -13,8 +13,8 @@ static void to_bjdata(const basic_json& j, detail::output_adapter<char> o,
|
|||||||
const bool use_size = false, const bool use_type = false);
|
const bool use_size = false, const bool use_type = false);
|
||||||
```
|
```
|
||||||
|
|
||||||
Serializes a given JSON value `j` to a byte vector using the BJData (Binary JData) serialization format. BJData
|
Serializes a given JSON value `j` to a byte vector using the BJData (Binary JData) serialization format. BJData aims to
|
||||||
aims to be more compact than JSON itself, yet more efficient to parse.
|
be more compact than JSON itself, yet more efficient to parse.
|
||||||
|
|
||||||
1. Returns a byte vector containing the BJData serialization.
|
1. Returns a byte vector containing the BJData serialization.
|
||||||
2. Writes the BJData serialization to an output adapter.
|
2. Writes the BJData serialization to an output adapter.
|
||||||
|
|||||||
@ -7,7 +7,7 @@ ValueType value(const typename object_t::key_type& key,
|
|||||||
ValueType&& default_value) const;
|
ValueType&& default_value) const;
|
||||||
|
|
||||||
// (2)
|
// (2)
|
||||||
template<class KeyType, class ValueType>
|
template<class ValueType, class KeyType>
|
||||||
ValueType value(KeyType&& key,
|
ValueType value(KeyType&& key,
|
||||||
ValueType&& default_value) const;
|
ValueType&& default_value) const;
|
||||||
|
|
||||||
@ -155,5 +155,5 @@ changes to any JSON value.
|
|||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
1. Added in version 1.0.0. Changed parameter `default_value` type from `const ValueType&` to `ValueType&&` in version 3.11.0.
|
1. Added in version 1.0.0. Changed parameter `default_value` type from `const ValueType&` to `ValueType&&` in version 3.11.0.
|
||||||
2. Added in version 3.11.0.
|
2. Added in version 3.11.0. Made `ValueType` the first template parameter in version 3.11.2.
|
||||||
3. Added in version 2.0.2.
|
3. Added in version 2.0.2.
|
||||||
|
|||||||
@ -52,10 +52,8 @@ functions [`is_null`](is_null.md), [`is_object`](is_object.md), [`is_array`](is_
|
|||||||
|
|
||||||
`operator<` and `operator<=>` (since C++20) are overloaded and compare according to the ordering described above.
|
`operator<` and `operator<=>` (since C++20) are overloaded and compare according to the ordering described above.
|
||||||
Until C++20 all other relational and equality operators yield results according to the integer value of each
|
Until C++20 all other relational and equality operators yield results according to the integer value of each
|
||||||
enumerator.
|
enumerator. Since C++20 some compilers consider the _rewritten candidates_ generated from `operator<=>` during
|
||||||
Since C++20 some compilers consider the _rewritten candidates_ generated from `operator<=>` during overload
|
overload resolution, while others do not. For predictable and portable behavior use:
|
||||||
resolution, while others do not.
|
|
||||||
For predictable and portable behavior use:
|
|
||||||
|
|
||||||
- `operator<` or `operator<=>` when wanting to compare according to the order described above
|
- `operator<` or `operator<=>` when wanting to compare according to the order described above
|
||||||
- `operator==` or `operator!=` when wanting to compare according to each enumerators integer value
|
- `operator==` or `operator!=` when wanting to compare according to each enumerators integer value
|
||||||
|
|||||||
@ -14,6 +14,8 @@ No-throw guarantee: this member function never throws exceptions.
|
|||||||
|
|
||||||
Linear.
|
Linear.
|
||||||
|
|
||||||
|
<!-- NOLINT Examples -->
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
- Added in version 1.0.0.
|
- Added in version 1.0.0.
|
||||||
|
|||||||
@ -29,6 +29,8 @@ are the base for JSON patches.
|
|||||||
- [(constructor)](json_pointer.md)
|
- [(constructor)](json_pointer.md)
|
||||||
- [**to_string**](to_string.md) - return a string representation of the JSON pointer
|
- [**to_string**](to_string.md) - return a string representation of the JSON pointer
|
||||||
- [**operator string_t**](operator_string_t.md) - return a string representation of the JSON pointer
|
- [**operator string_t**](operator_string_t.md) - return a string representation of the JSON pointer
|
||||||
|
- [**operator==**](operator_eq.md) - compare: equal
|
||||||
|
- [**operator!=**](operator_ne.md) - compare: not equal
|
||||||
- [**operator/=**](operator_slasheq.md) - append to the end of the JSON pointer
|
- [**operator/=**](operator_slasheq.md) - append to the end of the JSON pointer
|
||||||
- [**operator/**](operator_slash.md) - create JSON Pointer by appending
|
- [**operator/**](operator_slash.md) - create JSON Pointer by appending
|
||||||
- [**parent_pointer**](parent_pointer.md) - returns the parent of this JSON pointer
|
- [**parent_pointer**](parent_pointer.md) - returns the parent of this JSON pointer
|
||||||
|
|||||||
113
docs/mkdocs/docs/api/json_pointer/operator_eq.md
Normal file
113
docs/mkdocs/docs/api/json_pointer/operator_eq.md
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
# <small>nlohmann::json_pointer::</small>operator==
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
// until C++20
|
||||||
|
template<typename RefStringTypeLhs, typename RefStringTypeRhs>
|
||||||
|
bool operator==(
|
||||||
|
const json_pointer<RefStringTypeLhs>& lhs,
|
||||||
|
const json_pointer<RefStringTypeRhs>& rhs) noexcept; // (1)
|
||||||
|
|
||||||
|
template<typename RefStringTypeLhs, typename StringType>
|
||||||
|
bool operator==(
|
||||||
|
const json_pointer<RefStringTypeLhs>& lhs,
|
||||||
|
const StringType& rhs); // (2)
|
||||||
|
|
||||||
|
template<typename RefStringTypeRhs, typename StringType>
|
||||||
|
bool operator==(
|
||||||
|
const StringType& lhs,
|
||||||
|
const json_pointer<RefStringTypeRhs>& rhs); // (2)
|
||||||
|
|
||||||
|
// since C++20
|
||||||
|
class json_pointer {
|
||||||
|
template<typename RefStringTypeRhs>
|
||||||
|
bool operator==(
|
||||||
|
const json_pointer<RefStringTypeRhs>& rhs) const noexcept; // (1)
|
||||||
|
|
||||||
|
bool operator==(const string_t& rhs) const; // (2)
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
1. Compares two JSON pointers for equality by comparing their reference tokens.
|
||||||
|
|
||||||
|
2. Compares a JSON pointer and a string or a string and a JSON pointer for equality by converting the string to a JSON
|
||||||
|
pointer and comparing the JSON pointers according to 1.
|
||||||
|
|
||||||
|
## Template parameters
|
||||||
|
|
||||||
|
`RefStringTypeLhs`, `RefStringTypeRhs`
|
||||||
|
: the string type of the left-hand side or right-hand side JSON pointer, respectively
|
||||||
|
|
||||||
|
`StringType`
|
||||||
|
: the string type derived from the `json_pointer` operand ([`json_pointer::string_t`](string_t.md))
|
||||||
|
|
||||||
|
## Parameters
|
||||||
|
|
||||||
|
`lhs` (in)
|
||||||
|
: first value to consider
|
||||||
|
|
||||||
|
`rhs` (in)
|
||||||
|
: second value to consider
|
||||||
|
|
||||||
|
## Return value
|
||||||
|
|
||||||
|
whether the values `lhs`/`*this` and `rhs` are equal
|
||||||
|
|
||||||
|
## Exception safety
|
||||||
|
|
||||||
|
1. No-throw guarantee: this function never throws exceptions.
|
||||||
|
2. Strong exception safety: if an exception occurs, the original value stays intact.
|
||||||
|
|
||||||
|
## Exceptions
|
||||||
|
|
||||||
|
1. (none)
|
||||||
|
2. The function can throw the following exceptions:
|
||||||
|
- Throws [parse_error.107](../../home/exceptions.md#jsonexceptionparse_error107) if the given JSON pointer `s` is
|
||||||
|
nonempty and does not begin with a slash (`/`); see example below.
|
||||||
|
- Throws [parse_error.108](../../home/exceptions.md#jsonexceptionparse_error108) if a tilde (`~`) in the given JSON
|
||||||
|
pointer `s` is not followed by `0` (representing `~`) or `1` (representing `/`); see example below.
|
||||||
|
|
||||||
|
## Complexity
|
||||||
|
|
||||||
|
Constant if `lhs` and `rhs` differ in the number of reference tokens, otherwise linear in the number of reference
|
||||||
|
tokens.
|
||||||
|
|
||||||
|
## Notes
|
||||||
|
|
||||||
|
!!! warning "Deprecation"
|
||||||
|
|
||||||
|
Overload 2 is deprecated and will be removed in a future major version release.
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
??? example "Example: (1) Comparing JSON pointers"
|
||||||
|
|
||||||
|
The example demonstrates comparing JSON pointers.
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
--8<-- "examples/json_pointer__operator__equal.cpp"
|
||||||
|
```
|
||||||
|
|
||||||
|
Output:
|
||||||
|
|
||||||
|
```
|
||||||
|
--8<-- "examples/json_pointer__operator__equal.output"
|
||||||
|
```
|
||||||
|
|
||||||
|
??? example "Example: (2) Comparing JSON pointers and strings"
|
||||||
|
|
||||||
|
The example demonstrates comparing JSON pointers and strings, and when doing so may raise an exception.
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
--8<-- "examples/json_pointer__operator__equal_stringtype.cpp"
|
||||||
|
```
|
||||||
|
|
||||||
|
Output:
|
||||||
|
|
||||||
|
```
|
||||||
|
--8<-- "examples/json_pointer__operator__equal_stringtype.output"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Version history
|
||||||
|
|
||||||
|
1. Added in version 2.1.0. Added C++20 member functions in version 3.11.2.
|
||||||
|
2. Added for backward compatibility and deprecated in version 3.11.2.
|
||||||
109
docs/mkdocs/docs/api/json_pointer/operator_ne.md
Normal file
109
docs/mkdocs/docs/api/json_pointer/operator_ne.md
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
# <small>nlohmann::json_pointer::</small>operator!=
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
// until C++20
|
||||||
|
template<typename RefStringTypeLhs, typename RefStringTypeRhs>
|
||||||
|
bool operator!=(
|
||||||
|
const json_pointer<RefStringTypeLhs>& lhs,
|
||||||
|
const json_pointer<RefStringTypeRhs>& rhs) noexcept; // (1)
|
||||||
|
|
||||||
|
template<typename RefStringTypeLhs, typename StringType>
|
||||||
|
bool operator!=(
|
||||||
|
const json_pointer<RefStringTypeLhs>& lhs,
|
||||||
|
const StringType& rhs); // (2)
|
||||||
|
|
||||||
|
template<typename RefStringTypeRhs, typename StringType>
|
||||||
|
bool operator!=(
|
||||||
|
const StringType& lhs,
|
||||||
|
const json_pointer<RefStringTypeRhs>& rhs); // (2)
|
||||||
|
```
|
||||||
|
|
||||||
|
1. Compares two JSON pointers for inequality by comparing their reference tokens.
|
||||||
|
|
||||||
|
2. Compares a JSON pointer and a string or a string and a JSON pointer for inequality by converting the string to a
|
||||||
|
JSON pointer and comparing the JSON pointers according to 1.
|
||||||
|
|
||||||
|
## Template parameters
|
||||||
|
|
||||||
|
`RefStringTypeLhs`, `RefStringTypeRhs`
|
||||||
|
: the string type of the left-hand side or right-hand side JSON pointer, respectively
|
||||||
|
|
||||||
|
`StringType`
|
||||||
|
: the string type derived from the `json_pointer` operand ([`json_pointer::string_t`](string_t.md))
|
||||||
|
|
||||||
|
## Parameters
|
||||||
|
|
||||||
|
`lhs` (in)
|
||||||
|
: first value to consider
|
||||||
|
|
||||||
|
`rhs` (in)
|
||||||
|
: second value to consider
|
||||||
|
|
||||||
|
## Return value
|
||||||
|
|
||||||
|
whether the values `lhs`/`*this` and `rhs` are not equal
|
||||||
|
|
||||||
|
## Exception safety
|
||||||
|
|
||||||
|
1. No-throw guarantee: this function never throws exceptions.
|
||||||
|
2. Strong exception safety: if an exception occurs, the original value stays intact.
|
||||||
|
|
||||||
|
## Exceptions
|
||||||
|
|
||||||
|
1. (none)
|
||||||
|
2. The function can throw the following exceptions:
|
||||||
|
- Throws [parse_error.107](../../home/exceptions.md#jsonexceptionparse_error107) if the given JSON pointer `s` is
|
||||||
|
nonempty and does not begin with a slash (`/`); see example below.
|
||||||
|
- Throws [parse_error.108](../../home/exceptions.md#jsonexceptionparse_error108) if a tilde (`~`) in the given JSON
|
||||||
|
pointer `s` is not followed by `0` (representing `~`) or `1` (representing `/`); see example below.
|
||||||
|
|
||||||
|
## Complexity
|
||||||
|
|
||||||
|
Constant if `lhs` and `rhs` differ in the number of reference tokens, otherwise linear in the number of reference
|
||||||
|
tokens.
|
||||||
|
|
||||||
|
## Notes
|
||||||
|
|
||||||
|
!!! note "Operator overload resolution"
|
||||||
|
|
||||||
|
Since C++20 overload resolution will consider the _rewritten candidate_ generated from
|
||||||
|
[`operator==`](operator_eq.md).
|
||||||
|
|
||||||
|
!!! warning "Deprecation"
|
||||||
|
|
||||||
|
Overload 2 is deprecated and will be removed in a future major version release.
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
??? example "Example: (1) Comparing JSON pointers"
|
||||||
|
|
||||||
|
The example demonstrates comparing JSON pointers.
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
--8<-- "examples/json_pointer__operator__notequal.cpp"
|
||||||
|
```
|
||||||
|
|
||||||
|
Output:
|
||||||
|
|
||||||
|
```
|
||||||
|
--8<-- "examples/json_pointer__operator__notequal.output"
|
||||||
|
```
|
||||||
|
|
||||||
|
??? example "Example: (2) Comparing JSON pointers and strings"
|
||||||
|
|
||||||
|
The example demonstrates comparing JSON pointers and strings, and when doing so may raise an exception.
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
--8<-- "examples/json_pointer__operator__notequal_stringtype.cpp"
|
||||||
|
```
|
||||||
|
|
||||||
|
Output:
|
||||||
|
|
||||||
|
```
|
||||||
|
--8<-- "examples/json_pointer__operator__notequal_stringtype.output"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Version history
|
||||||
|
|
||||||
|
1. Added in version 2.1.0.
|
||||||
|
2. Added for backward compatibility and deprecated in version 3.11.2.
|
||||||
@ -23,7 +23,7 @@ It is safe to move the passed binary value.
|
|||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
.The example below shows how the SAX interface is used.
|
The example below shows how the SAX interface is used.
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
--8<-- "examples/sax_parse__binary.cpp"
|
--8<-- "examples/sax_parse__binary.cpp"
|
||||||
|
|||||||
@ -19,7 +19,7 @@ Whether parsing should proceed.
|
|||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
.The example below shows how the SAX interface is used.
|
The example below shows how the SAX interface is used.
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
--8<-- "examples/sax_parse.cpp"
|
--8<-- "examples/sax_parse.cpp"
|
||||||
|
|||||||
@ -14,7 +14,7 @@ Whether parsing should proceed.
|
|||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
.The example below shows how the SAX interface is used.
|
The example below shows how the SAX interface is used.
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
--8<-- "examples/sax_parse.cpp"
|
--8<-- "examples/sax_parse.cpp"
|
||||||
|
|||||||
@ -14,7 +14,7 @@ Whether parsing should proceed.
|
|||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
.The example below shows how the SAX interface is used.
|
The example below shows how the SAX interface is used.
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
--8<-- "examples/sax_parse.cpp"
|
--8<-- "examples/sax_parse.cpp"
|
||||||
|
|||||||
@ -23,7 +23,7 @@ It is safe to move the passed object key value.
|
|||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
.The example below shows how the SAX interface is used.
|
The example below shows how the SAX interface is used.
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
--8<-- "examples/sax_parse.cpp"
|
--8<-- "examples/sax_parse.cpp"
|
||||||
|
|||||||
@ -14,7 +14,7 @@ Whether parsing should proceed.
|
|||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
.The example below shows how the SAX interface is used.
|
The example below shows how the SAX interface is used.
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
--8<-- "examples/sax_parse.cpp"
|
--8<-- "examples/sax_parse.cpp"
|
||||||
|
|||||||
@ -22,7 +22,7 @@ Whether parsing should proceed.
|
|||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
.The example below shows how the SAX interface is used.
|
The example below shows how the SAX interface is used.
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
--8<-- "examples/sax_parse.cpp"
|
--8<-- "examples/sax_parse.cpp"
|
||||||
|
|||||||
@ -19,7 +19,7 @@ Whether parsing should proceed.
|
|||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
.The example below shows how the SAX interface is used.
|
The example below shows how the SAX interface is used.
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
--8<-- "examples/sax_parse.cpp"
|
--8<-- "examples/sax_parse.cpp"
|
||||||
|
|||||||
@ -19,7 +19,7 @@ Whether parsing should proceed.
|
|||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
.The example below shows how the SAX interface is used.
|
The example below shows how the SAX interface is used.
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
--8<-- "examples/sax_parse.cpp"
|
--8<-- "examples/sax_parse.cpp"
|
||||||
|
|||||||
@ -27,7 +27,7 @@ Whether parsing should proceed (**must return `#!cpp false`**).
|
|||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
.The example below shows how the SAX interface is used.
|
The example below shows how the SAX interface is used.
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
--8<-- "examples/sax_parse.cpp"
|
--8<-- "examples/sax_parse.cpp"
|
||||||
|
|||||||
@ -23,7 +23,7 @@ Binary formats may report the number of elements.
|
|||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
.The example below shows how the SAX interface is used.
|
The example below shows how the SAX interface is used.
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
--8<-- "examples/sax_parse.cpp"
|
--8<-- "examples/sax_parse.cpp"
|
||||||
|
|||||||
@ -23,7 +23,7 @@ Binary formats may report the number of elements.
|
|||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
.The example below shows how the SAX interface is used.
|
The example below shows how the SAX interface is used.
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
--8<-- "examples/sax_parse.cpp"
|
--8<-- "examples/sax_parse.cpp"
|
||||||
|
|||||||
@ -23,7 +23,7 @@ It is safe to move the passed string value.
|
|||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
.The example below shows how the SAX interface is used.
|
The example below shows how the SAX interface is used.
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
--8<-- "examples/sax_parse.cpp"
|
--8<-- "examples/sax_parse.cpp"
|
||||||
|
|||||||
@ -32,7 +32,10 @@ header. See also the [macro overview page](../../features/macros.md).
|
|||||||
## Library namespace
|
## Library namespace
|
||||||
|
|
||||||
- [**NLOHMANN_JSON_NAMESPACE**](nlohmann_json_namespace.md) - full name of the `nlohmann` namespace
|
- [**NLOHMANN_JSON_NAMESPACE**](nlohmann_json_namespace.md) - full name of the `nlohmann` namespace
|
||||||
- [**NLOHMANN_JSON_NAMESPACE_BEGIN**<br>**NLOHMANN_JSON_NAMESPACE_END**](nlohmann_json_namespace_begin.md) - open and close the library namespace
|
- [**NLOHMANN_JSON_NAMESPACE_BEGIN**<br>**NLOHMANN_JSON_NAMESPACE_END**](nlohmann_json_namespace_begin.md) - open and
|
||||||
|
close the library namespace
|
||||||
|
- [**NLOHMANN_JSON_NAMESPACE_NO_VERSION**](nlohmann_json_namespace_no_version.md) - disable the version component of
|
||||||
|
the inline namespace
|
||||||
|
|
||||||
## Type conversions
|
## Type conversions
|
||||||
|
|
||||||
|
|||||||
@ -21,8 +21,7 @@ When the macro is not defined, the library will define it to its default value.
|
|||||||
|
|
||||||
!!! info "Future behavior change"
|
!!! info "Future behavior change"
|
||||||
|
|
||||||
The user-defined string literals will be removed from the global namespace in the next major release of the
|
The user-defined string literals will be removed from the global namespace in the next major release of the library.
|
||||||
library.
|
|
||||||
|
|
||||||
To prepare existing code, define `JSON_USE_GLOBAL_UDLS` to `0` and bring the string literals into scope where
|
To prepare existing code, define `JSON_USE_GLOBAL_UDLS` to `0` and bring the string literals into scope where
|
||||||
needed. Refer to any of the [string literals](#see-also) for details.
|
needed. Refer to any of the [string literals](#see-also) for details.
|
||||||
@ -30,8 +29,8 @@ When the macro is not defined, the library will define it to its default value.
|
|||||||
!!! hint "CMake option"
|
!!! hint "CMake option"
|
||||||
|
|
||||||
The placement of user-defined string literals can also be controlled with the CMake option
|
The placement of user-defined string literals can also be controlled with the CMake option
|
||||||
[`JSON_GlobalUDLs`](../../integration/cmake.md#json_globaludls) (`OFF` by default)
|
[`JSON_GlobalUDLs`](../../integration/cmake.md#json_globaludls) (`ON` by default) which defines
|
||||||
which defines `JSON_USE_GLOBAL_UDLS` accordingly.
|
`JSON_USE_GLOBAL_UDLS` accordingly.
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
|
|||||||
@ -4,8 +4,8 @@
|
|||||||
#define JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON /* value */
|
#define JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON /* value */
|
||||||
```
|
```
|
||||||
|
|
||||||
This macro enables the (incorrect) legacy comparison behavior of discarded JSON values.
|
This macro enables the (incorrect) legacy comparison behavior of discarded JSON values. Possible values are `1` to
|
||||||
Possible values are `1` to enable or `0` to disable (default).
|
enable or `0` to disable (default).
|
||||||
|
|
||||||
When enabled, comparisons involving at least one discarded JSON value yield results as follows:
|
When enabled, comparisons involving at least one discarded JSON value yield results as follows:
|
||||||
|
|
||||||
@ -42,19 +42,16 @@ When the macro is not defined, the library will define it to its default value.
|
|||||||
`JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON`.
|
`JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON`.
|
||||||
- Overloads for the equality and relational operators emulate the legacy behavior.
|
- Overloads for the equality and relational operators emulate the legacy behavior.
|
||||||
|
|
||||||
Code outside your control may use either 3-way comparison or the equality and
|
Code outside your control may use either 3-way comparison or the equality and relational operators, resulting in
|
||||||
relational operators, resulting in inconsistent and unpredictable behavior.
|
inconsistent and unpredictable behavior.
|
||||||
|
|
||||||
See [`operator<=>`](../basic_json/operator_spaceship.md) for more information on 3-way
|
See [`operator<=>`](../basic_json/operator_spaceship.md) for more information on 3-way comparison.
|
||||||
comparison.
|
|
||||||
|
|
||||||
!!! warning "Deprecation"
|
!!! warning "Deprecation"
|
||||||
|
|
||||||
The legacy comparison behavior is deprecated and may be removed in a future major
|
The legacy comparison behavior is deprecated and may be removed in a future major version release.
|
||||||
version release.
|
|
||||||
|
|
||||||
New code should not depend on it and existing code should try to remove or rewrite
|
New code should not depend on it and existing code should try to remove or rewrite expressions relying on it.
|
||||||
expressions relying on it.
|
|
||||||
|
|
||||||
!!! hint "CMake option"
|
!!! hint "CMake option"
|
||||||
|
|
||||||
|
|||||||
@ -7,9 +7,9 @@
|
|||||||
|
|
||||||
These macros can be used to simplify the serialization/deserialization of types if you want to use a JSON object as
|
These macros can be used to simplify the serialization/deserialization of types if you want to use a JSON object as
|
||||||
serialization and want to use the member variable names as object keys in that object. The macro is to be defined
|
serialization and want to use the member variable names as object keys in that object. The macro is to be defined
|
||||||
**inside** the class/struct to create code for.
|
**inside** the class/struct to create code for. Unlike
|
||||||
Unlike [`NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE`](nlohmann_define_type_non_intrusive.md), it can access private members.
|
[`NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE`](nlohmann_define_type_non_intrusive.md), it can access private members. The first
|
||||||
The first parameter is the name of the class/struct, and all remaining parameters name the members.
|
parameter is the name of the class/struct, and all remaining parameters name the members.
|
||||||
|
|
||||||
1. Will use [`at`](../basic_json/at.md) during deserialization and will throw
|
1. Will use [`at`](../basic_json/at.md) during deserialization and will throw
|
||||||
[`out_of_range.403`](../../home/exceptions.md#jsonexceptionout_of_range403) if a key is missing in the JSON object.
|
[`out_of_range.403`](../../home/exceptions.md#jsonexceptionout_of_range403) if a key is missing in the JSON object.
|
||||||
@ -40,8 +40,8 @@ See examples below for the concrete generated code.
|
|||||||
|
|
||||||
!!! info "Prerequisites"
|
!!! info "Prerequisites"
|
||||||
|
|
||||||
1. The type `type` must be default constructible. See [How can I use `get()` for non-default constructible/non-copyable types?][GetNonDefNonCopy]
|
1. The type `type` must be default constructible. See [How can I use `get()` for non-default
|
||||||
for how to overcome this limitation.
|
constructible/non-copyable types?][GetNonDefNonCopy] for how to overcome this limitation.
|
||||||
2. The macro must be used inside the type (class/struct).
|
2. The macro must be used inside the type (class/struct).
|
||||||
|
|
||||||
[GetNonDefNonCopy]: ../../features/arbitrary_types.md#how-can-i-use-get-for-non-default-constructiblenon-copyable-types
|
[GetNonDefNonCopy]: ../../features/arbitrary_types.md#how-can-i-use-get-for-non-default-constructiblenon-copyable-types
|
||||||
|
|||||||
@ -7,9 +7,9 @@
|
|||||||
|
|
||||||
These macros can be used to simplify the serialization/deserialization of types if you want to use a JSON object as
|
These macros can be used to simplify the serialization/deserialization of types if you want to use a JSON object as
|
||||||
serialization and want to use the member variable names as object keys in that object. The macro is to be defined
|
serialization and want to use the member variable names as object keys in that object. The macro is to be defined
|
||||||
**outside** the class/struct to create code for, but **inside** its namespace.
|
**outside** the class/struct to create code for, but **inside** its namespace. Unlike
|
||||||
Unlike [`NLOHMANN_DEFINE_TYPE_INTRUSIVE`](nlohmann_define_type_intrusive.md), it **cannot** access private members.
|
[`NLOHMANN_DEFINE_TYPE_INTRUSIVE`](nlohmann_define_type_intrusive.md), it **cannot** access private members. The first
|
||||||
The first parameter is the name of the class/struct, and all remaining parameters name the members.
|
parameter is the name of the class/struct, and all remaining parameters name the members.
|
||||||
|
|
||||||
1. Will use [`at`](../basic_json/at.md) during deserialization and will throw
|
1. Will use [`at`](../basic_json/at.md) during deserialization and will throw
|
||||||
[`out_of_range.403`](../../home/exceptions.md#jsonexceptionout_of_range403) if a key is missing in the JSON object.
|
[`out_of_range.403`](../../home/exceptions.md#jsonexceptionout_of_range403) if a key is missing in the JSON object.
|
||||||
@ -103,7 +103,8 @@ See examples below for the concrete generated code.
|
|||||||
- `ns::person` is default-constructible. This is a requirement for using the macro.
|
- `ns::person` is default-constructible. This is a requirement for using the macro.
|
||||||
- `ns::person` has only public member variables. This makes `NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT`
|
- `ns::person` has only public member variables. This makes `NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT`
|
||||||
applicable.
|
applicable.
|
||||||
- The macro `NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT` is used _outside_ the class, but _inside_ its namespace `ns`.
|
- The macro `NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT` is used _outside_ the class, but _inside_ its
|
||||||
|
namespace `ns`.
|
||||||
- A missing key "age" in the deserialization does not yield an exception. Instead, the default value `-1` is used.
|
- A missing key "age" in the deserialization does not yield an exception. Instead, the default value `-1` is used.
|
||||||
|
|
||||||
The macro is equivalent to:
|
The macro is equivalent to:
|
||||||
|
|||||||
@ -1,26 +1,41 @@
|
|||||||
# NLOHMANN_JSON_NAMESPACE
|
# NLOHMANN_JSON_NAMESPACE
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
#define NLOHMANN_JSON_NAMESPACE
|
#define NLOHMANN_JSON_NAMESPACE /* value */
|
||||||
```
|
```
|
||||||
|
|
||||||
This macro evaluates to the full name of the `nlohmann` namespace, including
|
This macro evaluates to the full name of the `nlohmann` namespace.
|
||||||
the name of a versioned and ABI-tagged inline namespace. Use this macro to
|
|
||||||
unambiguously refer to the `nlohmann` namespace.
|
|
||||||
|
|
||||||
## Default definition
|
## Default definition
|
||||||
|
|
||||||
The default value consists of a prefix, a version string, and optional ABI tags
|
The default value consists of the root namespace (`nlohmann`) and an inline ABI namespace. See
|
||||||
depending on whether ABI-affecting macros are defined (e.g.,
|
[`nlohmann` Namespace](../../features/namespace.md#structure) for details.
|
||||||
[`JSON_DIAGNOSTICS`](json_diagnostics.md), and
|
|
||||||
[`JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON`](json_use_legacy_discarded_value_comparison.md)).
|
|
||||||
|
|
||||||
When the macro is not defined, the library will define it to its default value.
|
When the macro is not defined, the library will define it to its default value. Overriding this value has no effect on
|
||||||
|
the library.
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
??? example
|
||||||
|
|
||||||
|
The example shows how to use `NLOHMANN_JSON_NAMESPACE` instead of just `nlohmann`, as well as how to output the value
|
||||||
|
of `NLOHMANN_JSON_NAMESPACE`.
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
--8<-- "examples/nlohmann_json_namespace.cpp"
|
||||||
|
```
|
||||||
|
|
||||||
|
Output:
|
||||||
|
|
||||||
|
```json
|
||||||
|
--8<-- "examples/nlohmann_json_namespace.output"
|
||||||
|
```
|
||||||
|
|
||||||
## See also
|
## See also
|
||||||
|
|
||||||
- [`NLOHMANN_JSON_NAMESPACE_BEGIN, NLOHMANN_JSON_NAMESPACE_END`](nlohmann_json_namespace_begin.md)
|
- [`NLOHMANN_JSON_NAMESPACE_BEGIN, NLOHMANN_JSON_NAMESPACE_END`](nlohmann_json_namespace_begin.md)
|
||||||
|
- [`NLOHMANN_JSON_NAMESPACE_NO_VERSION`](nlohmann_json_namespace_no_version.md)
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
- Added in version 3.11.0.
|
- Added in version 3.11.0. Changed inline namespace name in version 3.11.2.
|
||||||
|
|||||||
@ -1,40 +1,61 @@
|
|||||||
# NLOHMANN_JSON_NAMESPACE_BEGIN, NLOHMANN_JSON_NAMESPACE_END
|
# NLOHMANN_JSON_NAMESPACE_BEGIN, NLOHMANN_JSON_NAMESPACE_END
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
#define NLOHMANN_JSON_NAMESPACE_BEGIN // (1)
|
#define NLOHMANN_JSON_NAMESPACE_BEGIN /* value */ // (1)
|
||||||
#define NLOHMANN_JSON_NAMESPACE_END // (2)
|
#define NLOHMANN_JSON_NAMESPACE_END /* value */ // (2)
|
||||||
```
|
```
|
||||||
|
|
||||||
These macros can be used to open and close the `nlohmann` namespace. They
|
These macros can be used to open and close the `nlohmann` namespace. See
|
||||||
include an inline namespace used to differentiate symbols when linking multiple
|
[`nlohmann` Namespace](../../features/namespace.md#structure) for details.
|
||||||
versions (including different ABI-affecting macros) of this library.
|
|
||||||
|
|
||||||
1. Opens the namespace.
|
1. Opens the namespace.
|
||||||
```cpp
|
|
||||||
namespace nlohmann
|
|
||||||
{
|
|
||||||
inline namespace json_v3_11_0
|
|
||||||
{
|
|
||||||
```
|
|
||||||
|
|
||||||
2. Closes the namespace.
|
2. Closes the namespace.
|
||||||
```cpp
|
|
||||||
} // namespace nlohmann
|
|
||||||
} // json_v3_11_0
|
|
||||||
```
|
|
||||||
|
|
||||||
## Default definition
|
## Default definition
|
||||||
|
|
||||||
The default definitions open and close the `nlohmann` as well as an inline
|
The default definitions open and close the `nlohmann` namespace. The precise definition of
|
||||||
namespace.
|
[`NLOHMANN_JSON_NAMESPACE_BEGIN`] varies as described [here](../../features/namespace.md#structure).
|
||||||
|
|
||||||
When these macros are not defined, the library will define them to their
|
1. Default definition of `NLOHMANN_JSON_NAMESPACE_BEGIN`:
|
||||||
default definitions.
|
|
||||||
|
```cpp
|
||||||
|
namespace nlohmann
|
||||||
|
{
|
||||||
|
inline namespace json_abi_v3_11_2
|
||||||
|
{
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Default definition of `NLOHMANN_JSON_NAMESPACE_END`:
|
||||||
|
```cpp
|
||||||
|
} // namespace json_abi_v3_11_2
|
||||||
|
} // namespace nlohmann
|
||||||
|
```
|
||||||
|
|
||||||
|
When these macros are not defined, the library will define them to their default definitions.
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
??? example
|
||||||
|
|
||||||
|
The example shows how to use `NLOHMANN_JSON_NAMESPACE_BEGIN`/`NLOHMANN_JSON_NAMESPACE_END` from the
|
||||||
|
[How do I convert third-party types?](../../features/arbitrary_types.md#how-do-i-convert-third-party-types) page.
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
--8<-- "examples/nlohmann_json_namespace_begin.c++17.cpp"
|
||||||
|
```
|
||||||
|
|
||||||
|
Output:
|
||||||
|
|
||||||
|
```json
|
||||||
|
--8<-- "examples/nlohmann_json_namespace_begin.c++17.output"
|
||||||
|
```
|
||||||
|
|
||||||
## See also
|
## See also
|
||||||
|
|
||||||
|
- [`nlohmann` Namespace](../../features/namespace.md)
|
||||||
- [NLOHMANN_JSON_NAMESPACE](nlohmann_json_namespace.md)
|
- [NLOHMANN_JSON_NAMESPACE](nlohmann_json_namespace.md)
|
||||||
|
- [`NLOHMANN_JSON_NAMESPACE_NO_VERSION`](nlohmann_json_namespace_no_version.md)
|
||||||
|
|
||||||
## Version history
|
## Version history
|
||||||
|
|
||||||
- Added in version 3.11.0.
|
- Added in version 3.11.0. Changed inline namespace name in version 3.11.2.
|
||||||
|
|||||||
@ -0,0 +1,45 @@
|
|||||||
|
# NLOHMANN_JSON_NAMESPACE_NO_VERSION
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
#define NLOHMANN_JSON_NAMESPACE_NO_VERSION /* value */
|
||||||
|
```
|
||||||
|
|
||||||
|
If defined to `1`, the version component is omitted from the inline namespace. See
|
||||||
|
[`nlohmann` Namespace](../../features/namespace.md#structure) for details.
|
||||||
|
|
||||||
|
## Default definition
|
||||||
|
|
||||||
|
The default value is `0`.
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
#define NLOHMANN_JSON_NAMESPACE_NO_VERSION 0
|
||||||
|
```
|
||||||
|
|
||||||
|
When the macro is not defined, the library will define it to its default value.
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
??? example
|
||||||
|
|
||||||
|
The example shows how to use `NLOHMANN_JSON_NAMESPACE_NO_VERSION` to disable the version component of the inline
|
||||||
|
namespace.
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
--8<-- "examples/nlohmann_json_namespace_no_version.cpp"
|
||||||
|
```
|
||||||
|
|
||||||
|
Output:
|
||||||
|
|
||||||
|
```json
|
||||||
|
--8<-- "examples/nlohmann_json_namespace_no_version.output"
|
||||||
|
```
|
||||||
|
|
||||||
|
## See also
|
||||||
|
|
||||||
|
- [`nlohmann` Namespace](../../features/namespace.md)
|
||||||
|
- [`NLOHMANN_JSON_NAMESPACE`](nlohmann_json_namespace.md)
|
||||||
|
- [`NLOHMANN_JSON_NAMESPACE_BEGIN, NLOHMANN_JSON_NAMESPACE_END`](nlohmann_json_namespace_begin.md)
|
||||||
|
|
||||||
|
## Version history
|
||||||
|
|
||||||
|
- Added in version 3.11.2.
|
||||||
@ -21,8 +21,7 @@ the stream `i`
|
|||||||
## Exceptions
|
## Exceptions
|
||||||
|
|
||||||
- Throws [`parse_error.101`](../home/exceptions.md#jsonexceptionparse_error101) in case of an unexpected token.
|
- Throws [`parse_error.101`](../home/exceptions.md#jsonexceptionparse_error101) in case of an unexpected token.
|
||||||
- Throws [`parse_error.102`](../home/exceptions.md#jsonexceptionparse_error102) if to_unicode fails or surrogate
|
- Throws [`parse_error.102`](../home/exceptions.md#jsonexceptionparse_error102) if to_unicode fails or surrogate error.
|
||||||
error.
|
|
||||||
- Throws [`parse_error.103`](../home/exceptions.md#jsonexceptionparse_error103) if to_unicode fails.
|
- Throws [`parse_error.103`](../home/exceptions.md#jsonexceptionparse_error103) if to_unicode fails.
|
||||||
|
|
||||||
## Complexity
|
## Complexity
|
||||||
|
|||||||
@ -15,8 +15,9 @@ using namespace nlohmann::json_literals;
|
|||||||
using namespace nlohmann::literals::json_literals;
|
using namespace nlohmann::literals::json_literals;
|
||||||
using namespace nlohmann;
|
using namespace nlohmann;
|
||||||
```
|
```
|
||||||
This is suggested to ease migration to the next major version release of the library.
|
|
||||||
See ['JSON_USE_GLOBAL_UDLS`](macros/json_use_global_udls.md#notes) for details.
|
This is suggested to ease migration to the next major version release of the library. See
|
||||||
|
['JSON_USE_GLOBAL_UDLS`](macros/json_use_global_udls.md#notes) for details.
|
||||||
|
|
||||||
## Parameters
|
## Parameters
|
||||||
|
|
||||||
|
|||||||
@ -15,8 +15,8 @@ using namespace nlohmann::json_literals;
|
|||||||
using namespace nlohmann::literals::json_literals;
|
using namespace nlohmann::literals::json_literals;
|
||||||
using namespace nlohmann;
|
using namespace nlohmann;
|
||||||
```
|
```
|
||||||
This is suggested to ease migration to the next major version release of the library.
|
This is suggested to ease migration to the next major version release of the library. See
|
||||||
See ['JSON_USE_GLOBAL_UDLS`](macros/json_use_global_udls.md#notes) for details.
|
['JSON_USE_GLOBAL_UDLS`](macros/json_use_global_udls.md#notes) for details.
|
||||||
|
|
||||||
## Parameters
|
## Parameters
|
||||||
|
|
||||||
|
|||||||
@ -35,7 +35,8 @@ the stream `o`
|
|||||||
## Exceptions
|
## Exceptions
|
||||||
|
|
||||||
1. Throws [`type_error.316`](../home/exceptions.md#jsonexceptiontype_error316) if a string stored inside the JSON
|
1. Throws [`type_error.316`](../home/exceptions.md#jsonexceptiontype_error316) if a string stored inside the JSON
|
||||||
value is not UTF-8 encoded. Note that unlike the [`dump`](basic_json/dump.md) member functions, no `error_handler` can be set.
|
value is not UTF-8 encoded. Note that unlike the [`dump`](basic_json/dump.md) member functions, no `error_handler`
|
||||||
|
can be set.
|
||||||
2. None.
|
2. None.
|
||||||
|
|
||||||
## Complexity
|
## Complexity
|
||||||
|
|||||||
@ -10,7 +10,7 @@ namespace ns {
|
|||||||
std::string address;
|
std::string address;
|
||||||
int age;
|
int age;
|
||||||
};
|
};
|
||||||
}
|
} // namespace ns
|
||||||
|
|
||||||
ns::person p = {"Ned Flanders", "744 Evergreen Terrace", 60};
|
ns::person p = {"Ned Flanders", "744 Evergreen Terrace", 60};
|
||||||
|
|
||||||
|
|||||||
@ -1,24 +1,21 @@
|
|||||||
# BJData
|
# BJData
|
||||||
|
|
||||||
The [BJData format](https://neurojson.org) was derived from and improved upon
|
The [BJData format](https://neurojson.org) was derived from and improved upon
|
||||||
[Universal Binary JSON(UBJSON)](https://ubjson.org) specification (Draft 12).
|
[Universal Binary JSON(UBJSON)](https://ubjson.org) specification (Draft 12). Specifically, it introduces an optimized
|
||||||
Specifically, it introduces an optimized array container for efficient storage
|
array container for efficient storage of N-dimensional packed arrays (**ND-arrays**); it also adds 4 new type markers -
|
||||||
of N-dimensional packed arrays (**ND-arrays**); it also adds 4 new type markers -
|
`[u] - uint16`, `[m] - uint32`, `[M] - uint64` and `[h] - float16` - to unambiguously map common binary numeric types;
|
||||||
`[u] - uint16`, `[m] - uint32`, `[M] - uint64` and `[h] - float16` - to
|
furthermore, it uses little-endian (LE) to store all numerics instead of big-endian (BE) as in UBJSON to avoid
|
||||||
unambigiously map common binary numeric types; furthermore, it uses little-endian
|
|
||||||
(LE) to store all numerics instead of big-endian (BE) as in UBJSON to avoid
|
|
||||||
unnecessary conversions on commonly available platforms.
|
unnecessary conversions on commonly available platforms.
|
||||||
|
|
||||||
Compared to other binary JSON-like formats such as MessagePack and CBOR, both BJData and
|
Compared to other binary JSON-like formats such as MessagePack and CBOR, both BJData and UBJSON demonstrate a rare
|
||||||
UBJSON demonstrate a rare combination of being both binary and **quasi-human-readable**. This
|
combination of being both binary and **quasi-human-readable**. This is because all semantic elements in BJData and
|
||||||
is because all semantic elements in BJData and UBJSON, including the data-type markers
|
UBJSON, including the data-type markers and name/string types are directly human-readable. Data stored in the
|
||||||
and name/string types are directly human-readable. Data stored in the BJData/UBJSON format
|
BJData/UBJSON format are not only compact in size, fast to read/write, but also can be directly searched or read using
|
||||||
are not only compact in size, fast to read/write, but also can be directly searched
|
simple processing.
|
||||||
or read using simple processing.
|
|
||||||
|
|
||||||
!!! abstract "References"
|
!!! abstract "References"
|
||||||
|
|
||||||
- [BJData Specification](https://neurojson.org/bjdata/draft2)
|
- [BJData Specification](https://neurojson.org/bjdata/draft2)
|
||||||
|
|
||||||
## Serialization
|
## Serialization
|
||||||
|
|
||||||
@ -55,67 +52,59 @@ The library uses the following mapping from JSON values types to BJData types ac
|
|||||||
|
|
||||||
!!! success "Complete mapping"
|
!!! success "Complete mapping"
|
||||||
|
|
||||||
The mapping is **complete** in the sense that any JSON value type can be converted to a BJData value.
|
The mapping is **complete** in the sense that any JSON value type can be converted to a BJData value.
|
||||||
|
|
||||||
Any BJData output created by `to_bjdata` can be successfully parsed by `from_bjdata`.
|
Any BJData output created by `to_bjdata` can be successfully parsed by `from_bjdata`.
|
||||||
|
|
||||||
!!! warning "Size constraints"
|
!!! warning "Size constraints"
|
||||||
|
|
||||||
The following values can **not** be converted to a BJData value:
|
The following values can **not** be converted to a BJData value:
|
||||||
|
|
||||||
- strings with more than 18446744073709551615 bytes, i.e., $2^{64}-1$ bytes (theoretical)
|
- strings with more than 18446744073709551615 bytes, i.e., $2^{64}-1$ bytes (theoretical)
|
||||||
|
|
||||||
!!! info "Unused BJData markers"
|
!!! info "Unused BJData markers"
|
||||||
|
|
||||||
The following markers are not used in the conversion:
|
The following markers are not used in the conversion:
|
||||||
|
|
||||||
- `Z`: no-op values are not created.
|
- `Z`: no-op values are not created.
|
||||||
- `C`: single-byte strings are serialized with `S` markers.
|
- `C`: single-byte strings are serialized with `S` markers.
|
||||||
|
|
||||||
!!! info "NaN/infinity handling"
|
!!! info "NaN/infinity handling"
|
||||||
|
|
||||||
If NaN or Infinity are stored inside a JSON number, they are
|
If NaN or Infinity are stored inside a JSON number, they are serialized properly. This behavior differs from the
|
||||||
serialized properly. This behavior differs from the `dump()`
|
`dump()` function which serializes NaN or Infinity to `#!json null`.
|
||||||
function which serializes NaN or Infinity to `null`.
|
|
||||||
|
|
||||||
|
|
||||||
!!! info "Endianness"
|
!!! info "Endianness"
|
||||||
|
|
||||||
A breaking difference between BJData and UBJSON is the endianness
|
A breaking difference between BJData and UBJSON is the endianness of numerical values. In BJData, all numerical data
|
||||||
of numerical values. In BJData, all numerical data types (integers
|
types (integers `UiuImlML` and floating-point values `hdD`) are stored in the little-endian (LE) byte order as
|
||||||
`UiuImlML` and floating-point values `hdD`) are stored in the little-endian (LE)
|
opposed to big-endian as used by UBJSON. Adopting LE to store numeric records avoids unnecessary byte swapping on
|
||||||
byte order as opposed to big-endian as used by UBJSON. Adopting LE
|
most modern computers where LE is used as the default byte order.
|
||||||
to store numeric records avoids unnecessary byte swapping on most modern
|
|
||||||
computers where LE is used as the default byte order.
|
|
||||||
|
|
||||||
!!! info "Optimized formats"
|
!!! info "Optimized formats"
|
||||||
|
|
||||||
Optimized formats for containers are supported via two parameters of
|
Optimized formats for containers are supported via two parameters of
|
||||||
[`to_bjdata`](../../api/basic_json/to_bjdata.md):
|
[`to_bjdata`](../../api/basic_json/to_bjdata.md):
|
||||||
|
|
||||||
- Parameter `use_size` adds size information to the beginning of a container and
|
- Parameter `use_size` adds size information to the beginning of a container and removes the closing marker.
|
||||||
removes the closing marker.
|
- Parameter `use_type` further checks whether all elements of a container have the same type and adds the type
|
||||||
- Parameter `use_type` further checks whether all elements of a container have the
|
marker to the beginning of the container. The `use_type` parameter must only be used together with
|
||||||
same type and adds the type marker to the beginning of the container.
|
`use_size = true`.
|
||||||
The `use_type` parameter must only be used together with `use_size = true`.
|
|
||||||
|
|
||||||
Note that `use_size = true` alone may result in larger representations -
|
Note that `use_size = true` alone may result in larger representations - the benefit of this parameter is that the
|
||||||
the benefit of this parameter is that the receiving side is
|
receiving side is immediately informed of the number of elements in the container.
|
||||||
immediately informed of the number of elements in the container.
|
|
||||||
|
|
||||||
!!! info "ND-array optimized format"
|
!!! info "ND-array optimized format"
|
||||||
|
|
||||||
BJData extends UBJSON's optimized array **size** marker to support ND-arrays of
|
BJData extends UBJSON's optimized array **size** marker to support ND-arrays of uniform numerical data types
|
||||||
uniform numerical data types (referred to as *packed arrays*).
|
(referred to as *packed arrays*). For example, the 2-D `uint8` integer array `[[1,2],[3,4],[5,6]]`, stored as nested
|
||||||
For example, the 2-D `uint8` integer array `[[1,2],[3,4],[5,6]]`, stored
|
optimized array in UBJSON `[ [$U#i2 1 2 [$U#i2 3 4 [$U#i2 5 6 ]`, can be further compressed in BJData to
|
||||||
as nested optimized array in UBJSON `[ [$U#i2 1 2 [$U#i2 3 4 [$U#i2 5 6 ]`,
|
`[$U#[$i#i2 2 3 1 2 3 4 5 6` or `[$U#[i2 i3] 1 2 3 4 5 6`.
|
||||||
can be further compressed in BJData to `[$U#[$i#i2 2 3 1 2 3 4 5 6`
|
|
||||||
or `[$U#[i2 i3] 1 2 3 4 5 6`.
|
|
||||||
|
|
||||||
To maintina type and size information, ND-arrays are converted to JSON objects following the
|
To maintain type and size information, ND-arrays are converted to JSON objects following the **annotated array
|
||||||
**annotated array format** (defined in the [JData specification (Draft 3)][JDataAAFmt]),
|
format** (defined in the [JData specification (Draft 3)][JDataAAFmt]), when parsed using
|
||||||
when parsed using [`from_bjdata`](../../api/basic_json/from_bjdata.md).
|
[`from_bjdata`](../../api/basic_json/from_bjdata.md). For example, the above 2-D `uint8` array can be parsed and
|
||||||
For example, the above 2-D `uint8` array can be parsed and accessed as
|
accessed as
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
@ -126,34 +115,28 @@ The library uses the following mapping from JSON values types to BJData types ac
|
|||||||
```
|
```
|
||||||
|
|
||||||
Likewise, when a JSON object in the above form is serialzed using
|
Likewise, when a JSON object in the above form is serialzed using
|
||||||
[`to_bjdata`](../../api/basic_json/to_bjdata.md), it is automatically converted
|
[`to_bjdata`](../../api/basic_json/to_bjdata.md), it is automatically converted into a compact BJData ND-array. The
|
||||||
into a compact BJData ND-array. The only exception is, that when the 1-dimensional
|
only exception is, that when the 1-dimensional vector stored in `"_ArraySize_"` contains a single integer or two
|
||||||
vector stored in `"_ArraySize_"` contains a single integer or two integers with one
|
integers with one being 1, a regular 1-D optimized array is generated.
|
||||||
being 1, a regular 1-D optimized array is generated.
|
|
||||||
|
|
||||||
The current version of this library does not yet support automatic detection of and
|
The current version of this library does not yet support automatic detection of and conversion from a nested JSON
|
||||||
conversion from a nested JSON array input to a BJData ND-array.
|
array input to a BJData ND-array.
|
||||||
|
|
||||||
[JDataAAFmt]: https://github.com/NeuroJSON/jdata/blob/master/JData_specification.md#annotated-storage-of-n-d-arrays)
|
[JDataAAFmt]: https://github.com/NeuroJSON/jdata/blob/master/JData_specification.md#annotated-storage-of-n-d-arrays)
|
||||||
|
|
||||||
!!! info "Restrictions in optimized data types for arrays and objects"
|
!!! info "Restrictions in optimized data types for arrays and objects"
|
||||||
|
|
||||||
Due to diminished space saving, hampered readability, and increased
|
Due to diminished space saving, hampered readability, and increased security risks, in BJData, the allowed data
|
||||||
security risks, in BJData, the allowed data types following the `$` marker
|
types following the `$` marker in an optimized array and object container are restricted to
|
||||||
in an optimized array and object container are restricted to
|
**non-zero-fixed-length** data types. Therefore, the valid optimized type markers can only be one of `UiuImlMLhdDC`.
|
||||||
**non-zero-fixed-length** data types. Therefore, the valid optimized
|
This also means other variable (`[{SH`) or zero-length types (`TFN`) can not be used in an optimized array or object
|
||||||
type markers can only be one of `UiuImlMLhdDC`. This also means other
|
in BJData.
|
||||||
variable (`[{SH`) or zero-length types (`TFN`) can not be used in an
|
|
||||||
optimized array or object in BJData.
|
|
||||||
|
|
||||||
!!! info "Binary values"
|
!!! info "Binary values"
|
||||||
|
|
||||||
If the JSON data contains the binary type, the value stored is a list
|
If the JSON data contains the binary type, the value stored is a list of integers, as suggested by the BJData
|
||||||
of integers, as suggested by the BJData documentation. In particular,
|
documentation. In particular, this means that the serialization and the deserialization of JSON containing binary
|
||||||
this means that the serialization and the deserialization of JSON
|
values into BJData and back will result in a different JSON object.
|
||||||
containing binary values into BJData and back will result in a
|
|
||||||
different JSON object.
|
|
||||||
|
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
@ -196,8 +179,7 @@ The library maps BJData types to JSON value types as follows:
|
|||||||
|
|
||||||
!!! success "Complete mapping"
|
!!! success "Complete mapping"
|
||||||
|
|
||||||
The mapping is **complete** in the sense that any BJData value can be converted to a JSON value.
|
The mapping is **complete** in the sense that any BJData value can be converted to a JSON value.
|
||||||
|
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -6,8 +6,8 @@ representation of data types that are not part of the JSON spec. For example, BS
|
|||||||
|
|
||||||
!!! abstract "References"
|
!!! abstract "References"
|
||||||
|
|
||||||
- [BSON Website](http://bsonspec.org) - the main source on BSON
|
- [BSON Website](http://bsonspec.org) - the main source on BSON
|
||||||
- [BSON Specification](http://bsonspec.org/spec.html) - the specification
|
- [BSON Specification](http://bsonspec.org/spec.html) - the specification
|
||||||
|
|
||||||
|
|
||||||
## Serialization
|
## Serialization
|
||||||
|
|||||||
@ -5,13 +5,14 @@ small code size, fairly small message size, and extensibility without the need f
|
|||||||
|
|
||||||
!!! abstract "References"
|
!!! abstract "References"
|
||||||
|
|
||||||
- [CBOR Website](http://cbor.io) - the main source on CBOR
|
- [CBOR Website](http://cbor.io) - the main source on CBOR
|
||||||
- [CBOR Playground](http://cbor.me) - an interactive webpage to translate between JSON and CBOR
|
- [CBOR Playground](http://cbor.me) - an interactive webpage to translate between JSON and CBOR
|
||||||
- [RFC 7049](https://tools.ietf.org/html/rfc7049) - the CBOR specification
|
- [RFC 7049](https://tools.ietf.org/html/rfc7049) - the CBOR specification
|
||||||
|
|
||||||
## Serialization
|
## Serialization
|
||||||
|
|
||||||
The library uses the following mapping from JSON values types to CBOR types according to the CBOR specification (RFC 7049):
|
The library uses the following mapping from JSON values types to CBOR types according to the CBOR specification
|
||||||
|
([RFC 7049](https://www.rfc-editor.org/rfc/rfc7049.html)):
|
||||||
|
|
||||||
| JSON value type | value/range | CBOR type | first byte |
|
| JSON value type | value/range | CBOR type | first byte |
|
||||||
|-----------------|--------------------------------------------|-----------------------------------|------------|
|
|-----------------|--------------------------------------------|-----------------------------------|------------|
|
||||||
@ -61,15 +62,15 @@ see "binary" cells in the table above.
|
|||||||
|
|
||||||
!!! success "Complete mapping"
|
!!! success "Complete mapping"
|
||||||
|
|
||||||
The mapping is **complete** in the sense that any JSON value type can be converted to a CBOR value.
|
The mapping is **complete** in the sense that any JSON value type can be converted to a CBOR value.
|
||||||
|
|
||||||
!!! info "NaN/infinity handling"
|
!!! info "NaN/infinity handling"
|
||||||
|
|
||||||
If NaN or Infinity are stored inside a JSON number, they are serialized properly. This behavior differs from the normal JSON serialization which serializes NaN or Infinity to `null`.
|
If NaN or Infinity are stored inside a JSON number, they are serialized properly. This behavior differs from the normal JSON serialization which serializes NaN or Infinity to `null`.
|
||||||
|
|
||||||
!!! info "Unused CBOR types"
|
!!! info "Unused CBOR types"
|
||||||
|
|
||||||
The following CBOR types are not used in the conversion:
|
The following CBOR types are not used in the conversion:
|
||||||
|
|
||||||
- UTF-8 strings terminated by "break" (0x7F)
|
- UTF-8 strings terminated by "break" (0x7F)
|
||||||
- arrays terminated by "break" (0x9F)
|
- arrays terminated by "break" (0x9F)
|
||||||
@ -149,7 +150,7 @@ The library maps CBOR types to JSON value types as follows:
|
|||||||
|
|
||||||
!!! warning "Incomplete mapping"
|
!!! warning "Incomplete mapping"
|
||||||
|
|
||||||
The mapping is **incomplete** in the sense that not all CBOR types can be converted to a JSON value. The following CBOR types are not supported and will yield parse errors:
|
The mapping is **incomplete** in the sense that not all CBOR types can be converted to a JSON value. The following CBOR types are not supported and will yield parse errors:
|
||||||
|
|
||||||
- date/time (0xC0..0xC1)
|
- date/time (0xC0..0xC1)
|
||||||
- bignum (0xC2..0xC3)
|
- bignum (0xC2..0xC3)
|
||||||
@ -161,7 +162,7 @@ The library maps CBOR types to JSON value types as follows:
|
|||||||
|
|
||||||
!!! warning "Object keys"
|
!!! warning "Object keys"
|
||||||
|
|
||||||
CBOR allows map keys of any type, whereas JSON only allows strings as keys in object values. Therefore, CBOR maps with keys other than UTF-8 strings are rejected.
|
CBOR allows map keys of any type, whereas JSON only allows strings as keys in object values. Therefore, CBOR maps with keys other than UTF-8 strings are rejected.
|
||||||
|
|
||||||
!!! warning "Tagged items"
|
!!! warning "Tagged items"
|
||||||
|
|
||||||
|
|||||||
@ -1,15 +1,18 @@
|
|||||||
# MessagePack
|
# MessagePack
|
||||||
|
|
||||||
MessagePack is an efficient binary serialization format. It lets you exchange data among multiple languages like JSON. But it's faster and smaller. Small integers are encoded into a single byte, and typical short strings require only one extra byte in addition to the strings themselves.
|
MessagePack is an efficient binary serialization format. It lets you exchange data among multiple languages like JSON.
|
||||||
|
But it's faster and smaller. Small integers are encoded into a single byte, and typical short strings require only one
|
||||||
|
extra byte in addition to the strings themselves.
|
||||||
|
|
||||||
!!! abstract "References"
|
!!! abstract "References"
|
||||||
|
|
||||||
- [MessagePack website](https://msgpack.org)
|
- [MessagePack website](https://msgpack.org)
|
||||||
- [MessagePack specification](https://github.com/msgpack/msgpack/blob/master/spec.md)
|
- [MessagePack specification](https://github.com/msgpack/msgpack/blob/master/spec.md)
|
||||||
|
|
||||||
## Serialization
|
## Serialization
|
||||||
|
|
||||||
The library uses the following mapping from JSON values types to MessagePack types according to the MessagePack specification:
|
The library uses the following mapping from JSON values types to MessagePack types according to the MessagePack
|
||||||
|
specification:
|
||||||
|
|
||||||
| JSON value type | value/range | MessagePack type | first byte |
|
| JSON value type | value/range | MessagePack type | first byte |
|
||||||
|-----------------|------------------------------------------|------------------|------------|
|
|-----------------|------------------------------------------|------------------|------------|
|
||||||
@ -49,22 +52,23 @@ The library uses the following mapping from JSON values types to MessagePack typ
|
|||||||
|
|
||||||
!!! success "Complete mapping"
|
!!! success "Complete mapping"
|
||||||
|
|
||||||
The mapping is **complete** in the sense that any JSON value type can be converted to a MessagePack value.
|
The mapping is **complete** in the sense that any JSON value type can be converted to a MessagePack value.
|
||||||
|
|
||||||
Any MessagePack output created by `to_msgpack` can be successfully parsed by `from_msgpack`.
|
Any MessagePack output created by `to_msgpack` can be successfully parsed by `from_msgpack`.
|
||||||
|
|
||||||
!!! warning "Size constraints"
|
!!! warning "Size constraints"
|
||||||
|
|
||||||
The following values can **not** be converted to a MessagePack value:
|
The following values can **not** be converted to a MessagePack value:
|
||||||
|
|
||||||
- strings with more than 4294967295 bytes
|
- strings with more than 4294967295 bytes
|
||||||
- byte strings with more than 4294967295 bytes
|
- byte strings with more than 4294967295 bytes
|
||||||
- arrays with more than 4294967295 elements
|
- arrays with more than 4294967295 elements
|
||||||
- objects with more than 4294967295 elements
|
- objects with more than 4294967295 elements
|
||||||
|
|
||||||
!!! info "NaN/infinity handling"
|
!!! info "NaN/infinity handling"
|
||||||
|
|
||||||
If NaN or Infinity are stored inside a JSON number, they are serialized properly. function which serializes NaN or Infinity to `null`.
|
If NaN or Infinity are stored inside a JSON number, they are serialized properly in contrast to the
|
||||||
|
[dump](../../api/basic_json/dump.md) function which serializes NaN or Infinity to `null`.
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
@ -123,7 +127,7 @@ The library maps MessagePack types to JSON value types as follows:
|
|||||||
|
|
||||||
!!! info
|
!!! info
|
||||||
|
|
||||||
Any MessagePack output created by `to_msgpack` can be successfully parsed by `from_msgpack`.
|
Any MessagePack output created by `to_msgpack` can be successfully parsed by `from_msgpack`.
|
||||||
|
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|||||||
@ -1,10 +1,11 @@
|
|||||||
# UBJSON
|
# UBJSON
|
||||||
|
|
||||||
Universal Binary JSON (UBJSON) is a binary form directly imitating JSON, but requiring fewer bytes of data. It aims to achieve the generality of JSON, combined with being much easier to process than JSON.
|
Universal Binary JSON (UBJSON) is a binary form directly imitating JSON, but requiring fewer bytes of data. It aims to
|
||||||
|
achieve the generality of JSON, combined with being much easier to process than JSON.
|
||||||
|
|
||||||
!!! abstract "References"
|
!!! abstract "References"
|
||||||
|
|
||||||
- [UBJSON Website](http://ubjson.org)
|
- [UBJSON Website](http://ubjson.org)
|
||||||
|
|
||||||
## Serialization
|
## Serialization
|
||||||
|
|
||||||
@ -36,50 +37,43 @@ The library uses the following mapping from JSON values types to UBJSON types ac
|
|||||||
|
|
||||||
!!! success "Complete mapping"
|
!!! success "Complete mapping"
|
||||||
|
|
||||||
The mapping is **complete** in the sense that any JSON value type can be converted to a UBJSON value.
|
The mapping is **complete** in the sense that any JSON value type can be converted to a UBJSON value.
|
||||||
|
|
||||||
Any UBJSON output created by `to_ubjson` can be successfully parsed by `from_ubjson`.
|
Any UBJSON output created by `to_ubjson` can be successfully parsed by `from_ubjson`.
|
||||||
|
|
||||||
!!! warning "Size constraints"
|
!!! warning "Size constraints"
|
||||||
|
|
||||||
The following values can **not** be converted to a UBJSON value:
|
The following values can **not** be converted to a UBJSON value:
|
||||||
|
|
||||||
- strings with more than 9223372036854775807 bytes (theoretical)
|
- strings with more than 9223372036854775807 bytes (theoretical)
|
||||||
|
|
||||||
!!! info "Unused UBJSON markers"
|
!!! info "Unused UBJSON markers"
|
||||||
|
|
||||||
The following markers are not used in the conversion:
|
The following markers are not used in the conversion:
|
||||||
|
|
||||||
- `Z`: no-op values are not created.
|
- `Z`: no-op values are not created.
|
||||||
- `C`: single-byte strings are serialized with `S` markers.
|
- `C`: single-byte strings are serialized with `S` markers.
|
||||||
|
|
||||||
!!! info "NaN/infinity handling"
|
!!! info "NaN/infinity handling"
|
||||||
|
|
||||||
If NaN or Infinity are stored inside a JSON number, they are
|
If NaN or Infinity are stored inside a JSON number, they are serialized properly. This behavior differs from the
|
||||||
serialized properly. This behavior differs from the `dump()`
|
`dump()` function which serializes NaN or Infinity to `null`.
|
||||||
function which serializes NaN or Infinity to `null`.
|
|
||||||
|
|
||||||
!!! info "Optimized formats"
|
!!! info "Optimized formats"
|
||||||
|
|
||||||
The optimized formats for containers are supported: Parameter
|
The optimized formats for containers are supported: Parameter `use_size` adds size information to the beginning of a
|
||||||
`use_size` adds size information to the beginning of a container and
|
container and removes the closing marker. Parameter `use_type` further checks whether all elements of a container
|
||||||
removes the closing marker. Parameter `use_type` further checks
|
have the same type and adds the type marker to the beginning of the container. The `use_type` parameter must only be
|
||||||
whether all elements of a container have the same type and adds the
|
used together with `use_size = true`.
|
||||||
type marker to the beginning of the container. The `use_type`
|
|
||||||
parameter must only be used together with `use_size = true`.
|
|
||||||
|
|
||||||
Note that `use_size = true` alone may result in larger representations -
|
Note that `use_size = true` alone may result in larger representations - the benefit of this parameter is that the
|
||||||
the benefit of this parameter is that the receiving side is
|
receiving side is immediately informed on the number of elements of the container.
|
||||||
immediately informed on the number of elements of the container.
|
|
||||||
|
|
||||||
!!! info "Binary values"
|
!!! info "Binary values"
|
||||||
|
|
||||||
If the JSON data contains the binary type, the value stored is a list
|
If the JSON data contains the binary type, the value stored is a list of integers, as suggested by the UBJSON
|
||||||
of integers, as suggested by the UBJSON documentation. In particular,
|
documentation. In particular, this means that serialization and the deserialization of a JSON containing binary
|
||||||
this means that serialization and the deserialization of a JSON
|
values into UBJSON and back will result in a different JSON object.
|
||||||
containing binary values into UBJSON and back will result in a
|
|
||||||
different JSON object.
|
|
||||||
|
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
@ -117,8 +111,7 @@ The library maps UBJSON types to JSON value types as follows:
|
|||||||
|
|
||||||
!!! success "Complete mapping"
|
!!! success "Complete mapping"
|
||||||
|
|
||||||
The mapping is **complete** in the sense that any UBJSON value can be converted to a JSON value.
|
The mapping is **complete** in the sense that any UBJSON value can be converted to a JSON value.
|
||||||
|
|
||||||
|
|
||||||
??? example
|
??? example
|
||||||
|
|
||||||
|
|||||||
@ -5,9 +5,9 @@ This library does not support comments *by default*. It does so for three reason
|
|||||||
1. Comments are not part of the [JSON specification](https://tools.ietf.org/html/rfc8259). You may argue that `//` or `/* */` are allowed in JavaScript, but JSON is not JavaScript.
|
1. Comments are not part of the [JSON specification](https://tools.ietf.org/html/rfc8259). You may argue that `//` or `/* */` are allowed in JavaScript, but JSON is not JavaScript.
|
||||||
2. This was not an oversight: Douglas Crockford [wrote on this](https://plus.google.com/118095276221607585885/posts/RK8qyGVaGSr) in May 2012:
|
2. This was not an oversight: Douglas Crockford [wrote on this](https://plus.google.com/118095276221607585885/posts/RK8qyGVaGSr) in May 2012:
|
||||||
|
|
||||||
> I removed comments from JSON because I saw people were using them to hold parsing directives, a practice which would have destroyed interoperability. I know that the lack of comments makes some people sad, but it shouldn't.
|
> I removed comments from JSON because I saw people were using them to hold parsing directives, a practice which would have destroyed interoperability. I know that the lack of comments makes some people sad, but it shouldn't.
|
||||||
|
|
||||||
> Suppose you are using JSON to keep configuration files, which you would like to annotate. Go ahead and insert all the comments you like. Then pipe it through JSMin before handing it to your JSON parser.
|
> Suppose you are using JSON to keep configuration files, which you would like to annotate. Go ahead and insert all the comments you like. Then pipe it through JSMin before handing it to your JSON parser.
|
||||||
|
|
||||||
3. It is dangerous for interoperability if some libraries would add comment support while others don't. Please check [The Harmful Consequences of the Robustness Principle](https://tools.ietf.org/html/draft-iab-protocol-maintenance-01) on this.
|
3. It is dangerous for interoperability if some libraries would add comment support while others don't. Please check [The Harmful Consequences of the Robustness Principle](https://tools.ietf.org/html/draft-iab-protocol-maintenance-01) on this.
|
||||||
|
|
||||||
|
|||||||
@ -99,7 +99,8 @@ that the passed index is the new maximal index. Intermediate values are filled w
|
|||||||
|
|
||||||
!!! failure "Exceptions"
|
!!! failure "Exceptions"
|
||||||
|
|
||||||
`operator[]` can only be used with objects (with a string argument) or with arrays (with a numeric argument). For other types, a [`basic_json::type_error`](../../home/exceptions.md#jsonexceptiontype_error305) is thrown.
|
`operator[]` can only be used with objects (with a string argument) or with arrays (with a numeric argument). For
|
||||||
|
other types, a [`basic_json::type_error`](../../home/exceptions.md#jsonexceptiontype_error305) is thrown.
|
||||||
|
|
||||||
## Summary
|
## Summary
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user