Merge branches 'develop' and 'mkdocs' of https://github.com/nlohmann/json into mkdocs
This commit is contained in:
		
						commit
						32bda1a7af
					
				
					 19 changed files with 409 additions and 276 deletions
				
			
		| 
						 | 
				
			
			@ -10,12 +10,9 @@ jobs:
 | 
			
		|||
      - run:
 | 
			
		||||
          name: Install required tools
 | 
			
		||||
          command: 'apt-get update && apt-get install -y gcc g++ git cmake'
 | 
			
		||||
      - run:
 | 
			
		||||
          name: Show versions
 | 
			
		||||
          command: 'g++ --version ; uname -a; cmake --version'
 | 
			
		||||
      - run:
 | 
			
		||||
          name: Run CMake
 | 
			
		||||
          command: 'mkdir build ; cd build ; cmake ..'
 | 
			
		||||
          command: 'mkdir build ; cd build ; cmake .. -DJSON_BuildTests=On'
 | 
			
		||||
      - run:
 | 
			
		||||
          name: Compile
 | 
			
		||||
          command: 'cmake --build build'
 | 
			
		||||
| 
						 | 
				
			
			@ -33,12 +30,9 @@ jobs:
 | 
			
		|||
      - run:
 | 
			
		||||
          name: Install required tools
 | 
			
		||||
          command: 'pacman -Sy --noconfirm base base-devel gcc git cmake'
 | 
			
		||||
      - run:
 | 
			
		||||
          name: Show versions
 | 
			
		||||
          command: 'g++ --version ; uname -a; cmake --version'
 | 
			
		||||
      - run:
 | 
			
		||||
          name: Run CMake
 | 
			
		||||
          command: 'mkdir build ; cd build ; cmake ..'
 | 
			
		||||
          command: 'mkdir build ; cd build ; cmake .. -DJSON_BuildTests=On'
 | 
			
		||||
      - run:
 | 
			
		||||
          name: Compile
 | 
			
		||||
          command: 'cmake --build build'
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										1
									
								
								.github/ISSUE_TEMPLATE/Feature_request.md
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.github/ISSUE_TEMPLATE/Feature_request.md
									
										
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -14,4 +14,3 @@ assignees: ''
 | 
			
		|||
#### How would the feature be usable for other users?
 | 
			
		||||
 | 
			
		||||
<!-- Include sample usage where appropriate. -->
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										6
									
								
								.github/ISSUE_TEMPLATE/question.md
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								.github/ISSUE_TEMPLATE/question.md
									
										
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -7,6 +7,8 @@ assignees: ''
 | 
			
		|||
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
<!-- Provide a concise summary of the issue in the title above. -->
 | 
			
		||||
 | 
			
		||||
#### What do you want to achieve?
 | 
			
		||||
 | 
			
		||||
<!-- Please describe the feature as detailed as possible. -->
 | 
			
		||||
| 
						 | 
				
			
			@ -17,6 +19,10 @@ assignees: ''
 | 
			
		|||
<!-- There is a full documentation of the API: https://nlohmann.github.io/json/ -->
 | 
			
		||||
<!-- There is a detailed README file: https://github.com/nlohmann/json/blob/develop/README.md -->
 | 
			
		||||
 | 
			
		||||
#### Can you provide a small code example?
 | 
			
		||||
 | 
			
		||||
<!-- Please understand that we cannot analyze and debug large code bases. -->
 | 
			
		||||
 | 
			
		||||
#### Which compiler and operating system are you using?
 | 
			
		||||
 | 
			
		||||
<!-- Include as many relevant details about the environment you experienced the bug in. -->
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										2
									
								
								.github/workflows/macos.yml
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/macos.yml
									
										
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -10,7 +10,7 @@ jobs:
 | 
			
		|||
    steps:
 | 
			
		||||
    - uses: actions/checkout@v1
 | 
			
		||||
    - name: cmake
 | 
			
		||||
      run: cmake -S . -B build -D CMAKE_BUILD_TYPE=Debug
 | 
			
		||||
      run: cmake -S . -B build -D CMAKE_BUILD_TYPE=Debug -DJSON_BuildTests=On
 | 
			
		||||
    - name: build
 | 
			
		||||
      run: cmake --build build --parallel 10
 | 
			
		||||
    - name: test
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										2
									
								
								.github/workflows/ubuntu.yml
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/ubuntu.yml
									
										
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -10,7 +10,7 @@ jobs:
 | 
			
		|||
    steps:
 | 
			
		||||
    - uses: actions/checkout@v1
 | 
			
		||||
    - name: cmake
 | 
			
		||||
      run: cmake -S . -B build -D CMAKE_BUILD_TYPE=Debug
 | 
			
		||||
      run: cmake -S . -B build -D CMAKE_BUILD_TYPE=Debug -DJSON_BuildTests=On
 | 
			
		||||
    - name: build
 | 
			
		||||
      run: cmake --build build --parallel 10
 | 
			
		||||
    - name: test
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										2
									
								
								.github/workflows/windows.yml
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/windows.yml
									
										
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -10,7 +10,7 @@ jobs:
 | 
			
		|||
    steps:
 | 
			
		||||
    - uses: actions/checkout@v1
 | 
			
		||||
    - name: cmake
 | 
			
		||||
      run: cmake -S . -B build -G "Visual Studio 16 2019" -D CMAKE_BUILD_TYPE=Debug
 | 
			
		||||
      run: cmake -S . -B build -G "Visual Studio 16 2019" -D CMAKE_BUILD_TYPE=Debug -DJSON_BuildTests=On
 | 
			
		||||
    - name: build
 | 
			
		||||
      run: cmake --build build --parallel 10
 | 
			
		||||
    - name: test
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -321,13 +321,9 @@ script:
 | 
			
		|||
  # by default, use the single-header version
 | 
			
		||||
  - if [[ "${MULTIPLE_HEADERS}" == "" ]]; then export MULTIPLE_HEADERS=OFF; fi
 | 
			
		||||
 | 
			
		||||
  # show OS/compiler version
 | 
			
		||||
  - uname -a
 | 
			
		||||
  - $CXX --version
 | 
			
		||||
 | 
			
		||||
  # compile and execute unit tests
 | 
			
		||||
  - mkdir -p build && cd build
 | 
			
		||||
  - cmake .. ${CMAKE_OPTIONS} -DJSON_MultipleHeaders=${MULTIPLE_HEADERS} -GNinja && cmake --build . --config Release
 | 
			
		||||
  - cmake .. ${CMAKE_OPTIONS} -DJSON_MultipleHeaders=${MULTIPLE_HEADERS} -DJSON_BuildTests=On -GNinja && cmake --build . --config Release
 | 
			
		||||
  - ctest -C Release --timeout 2700 -V -j
 | 
			
		||||
  - cd ..
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										92
									
								
								Makefile
									
										
									
									
									
								
							
							
						
						
									
										92
									
								
								Makefile
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -116,7 +116,7 @@ pedantic_clang:
 | 
			
		|||
		-Wno-padded \
 | 
			
		||||
		-Wno-range-loop-analysis \
 | 
			
		||||
		-Wno-switch-enum -Wno-covered-switch-default \
 | 
			
		||||
		-Wno-weak-vtables" cmake -S . -B build_pedantic -GNinja -DCMAKE_BUILD_TYPE=Debug -DJSON_MultipleHeaders=ON
 | 
			
		||||
		-Wno-weak-vtables" cmake -S . -B build_pedantic -GNinja -DCMAKE_BUILD_TYPE=Debug -DJSON_MultipleHeaders=ON -DJSON_BuildTests=On
 | 
			
		||||
	cmake --build build_pedantic
 | 
			
		||||
 | 
			
		||||
# calling GCC with most warnings
 | 
			
		||||
| 
						 | 
				
			
			@ -124,13 +124,37 @@ pedantic_gcc:
 | 
			
		|||
	rm -fr build_pedantic
 | 
			
		||||
	CXXFLAGS=" \
 | 
			
		||||
		-std=c++11 \
 | 
			
		||||
		-pedantic \
 | 
			
		||||
		-Werror \
 | 
			
		||||
		--all-warnings                                    \
 | 
			
		||||
		--extra-warnings                                  \
 | 
			
		||||
		-W                                                \
 | 
			
		||||
		-Wno-abi-tag                                         \
 | 
			
		||||
		-Waddress                                         \
 | 
			
		||||
		-Waddress-of-packed-member                        \
 | 
			
		||||
		-Wno-aggregate-return                                \
 | 
			
		||||
		-Waggressive-loop-optimizations                   \
 | 
			
		||||
		-Waligned-new=all                                 \
 | 
			
		||||
		-Wall                                             \
 | 
			
		||||
		-Walloc-zero                                      \
 | 
			
		||||
		-Walloca                                          \
 | 
			
		||||
		-Wanalyzer-double-fclose                          \
 | 
			
		||||
		-Wanalyzer-double-free                            \
 | 
			
		||||
		-Wanalyzer-exposure-through-output-file           \
 | 
			
		||||
		-Wanalyzer-file-leak                              \
 | 
			
		||||
		-Wanalyzer-free-of-non-heap                       \
 | 
			
		||||
		-Wanalyzer-malloc-leak                            \
 | 
			
		||||
		-Wanalyzer-null-argument                          \
 | 
			
		||||
		-Wanalyzer-null-dereference                       \
 | 
			
		||||
		-Wanalyzer-possible-null-argument                 \
 | 
			
		||||
		-Wanalyzer-possible-null-dereference              \
 | 
			
		||||
		-Wanalyzer-stale-setjmp-buffer                    \
 | 
			
		||||
		-Wanalyzer-tainted-array-index                    \
 | 
			
		||||
		-Wanalyzer-too-complex                            \
 | 
			
		||||
		-Wanalyzer-unsafe-call-within-signal-handler      \
 | 
			
		||||
		-Wanalyzer-use-after-free                         \
 | 
			
		||||
		-Wanalyzer-use-of-pointer-in-stale-stack-frame    \
 | 
			
		||||
		-Warith-conversion                                \
 | 
			
		||||
		-Warray-bounds                                    \
 | 
			
		||||
		-Warray-bounds=2                                  \
 | 
			
		||||
		-Wattribute-alias=2                               \
 | 
			
		||||
| 
						 | 
				
			
			@ -140,8 +164,16 @@ pedantic_gcc:
 | 
			
		|||
		-Wbool-operation                                  \
 | 
			
		||||
		-Wbuiltin-declaration-mismatch                    \
 | 
			
		||||
		-Wbuiltin-macro-redefined                         \
 | 
			
		||||
		-Wc++0x-compat                                    \
 | 
			
		||||
		-Wc++11-compat                                    \
 | 
			
		||||
		-Wc++14-compat                                    \
 | 
			
		||||
		-Wc++17-compat                                    \
 | 
			
		||||
		-Wc++1z-compat                                    \
 | 
			
		||||
		-Wc++20-compat                                    \
 | 
			
		||||
		-Wc++2a-compat                                    \
 | 
			
		||||
		-Wcannot-profile                                  \
 | 
			
		||||
		-Wcast-align                                      \
 | 
			
		||||
		-Wcast-align=strict                               \
 | 
			
		||||
		-Wcast-function-type                              \
 | 
			
		||||
		-Wcast-qual                                       \
 | 
			
		||||
		-Wcatch-value=3                                   \
 | 
			
		||||
| 
						 | 
				
			
			@ -149,6 +181,7 @@ pedantic_gcc:
 | 
			
		|||
		-Wclass-conversion                                \
 | 
			
		||||
		-Wclass-memaccess                                 \
 | 
			
		||||
		-Wclobbered                                       \
 | 
			
		||||
		-Wcomma-subscript                                 \
 | 
			
		||||
		-Wcomment                                         \
 | 
			
		||||
		-Wcomments                                        \
 | 
			
		||||
		-Wconditionally-supported                         \
 | 
			
		||||
| 
						 | 
				
			
			@ -175,20 +208,20 @@ pedantic_gcc:
 | 
			
		|||
		-Wendif-labels                                    \
 | 
			
		||||
		-Wenum-compare                                    \
 | 
			
		||||
		-Wexpansion-to-defined                            \
 | 
			
		||||
		-Werror \
 | 
			
		||||
		-Wextra                                           \
 | 
			
		||||
		-Wextra-semi                                      \
 | 
			
		||||
		-Wfloat-conversion                                \
 | 
			
		||||
		-Wformat \
 | 
			
		||||
		-Wformat-contains-nul \
 | 
			
		||||
		-Wformat-extra-args \
 | 
			
		||||
		-Wformat-nonliteral \
 | 
			
		||||
		-Wfloat-equal                                     \
 | 
			
		||||
		-Wformat -Wformat-contains-nul                    \
 | 
			
		||||
		-Wformat -Wformat-extra-args                      \
 | 
			
		||||
		-Wformat -Wformat-nonliteral                      \
 | 
			
		||||
		-Wformat -Wformat-security                        \
 | 
			
		||||
		-Wformat -Wformat-y2k                             \
 | 
			
		||||
		-Wformat -Wformat-zero-length                     \
 | 
			
		||||
		-Wformat-diag                                     \
 | 
			
		||||
		-Wformat-overflow=2                               \
 | 
			
		||||
		-Wformat-security \
 | 
			
		||||
		-Wformat-signedness                               \
 | 
			
		||||
		-Wformat-truncation=2                             \
 | 
			
		||||
		-Wformat-y2k \
 | 
			
		||||
		-Wformat-zero-length \
 | 
			
		||||
		-Wformat=2                                        \
 | 
			
		||||
		-Wframe-address                                   \
 | 
			
		||||
		-Wfree-nonheap-object                             \
 | 
			
		||||
| 
						 | 
				
			
			@ -197,6 +230,7 @@ pedantic_gcc:
 | 
			
		|||
		-Wignored-attributes                              \
 | 
			
		||||
		-Wignored-qualifiers                              \
 | 
			
		||||
		-Wimplicit-fallthrough=5                          \
 | 
			
		||||
		-Winaccessible-base                               \
 | 
			
		||||
		-Winherited-variadic-ctor                         \
 | 
			
		||||
		-Winit-list-lifetime                              \
 | 
			
		||||
		-Winit-self                                       \
 | 
			
		||||
| 
						 | 
				
			
			@ -209,33 +243,25 @@ pedantic_gcc:
 | 
			
		|||
		-Wliteral-suffix                                  \
 | 
			
		||||
		-Wlogical-not-parentheses                         \
 | 
			
		||||
		-Wlogical-op                                      \
 | 
			
		||||
		-Wno-long-long                                       \
 | 
			
		||||
		-Wlto-type-mismatch                               \
 | 
			
		||||
		-Wmain                                            \
 | 
			
		||||
		-Wmaybe-uninitialized                             \
 | 
			
		||||
		-Wmemset-elt-size                                 \
 | 
			
		||||
		-Wmemset-transposed-args                          \
 | 
			
		||||
		-Wmisleading-indentation                          \
 | 
			
		||||
		-Wmismatched-tags                                 \
 | 
			
		||||
		-Wmissing-attributes                              \
 | 
			
		||||
		-Wmissing-braces                                  \
 | 
			
		||||
		-Wmissing-declarations                            \
 | 
			
		||||
		-Wmissing-field-initializers                      \
 | 
			
		||||
		-Wmissing-format-attribute \
 | 
			
		||||
		-Wmissing-include-dirs                            \
 | 
			
		||||
		-Wmissing-noreturn \
 | 
			
		||||
		-Wmissing-profile                                 \
 | 
			
		||||
		-Wmultichar                                       \
 | 
			
		||||
		-Wmultiple-inheritance                            \
 | 
			
		||||
		-Wmultistatement-macros                           \
 | 
			
		||||
		-Wnarrowing \
 | 
			
		||||
		-Wno-deprecated-declarations \
 | 
			
		||||
		-Wno-float-equal \
 | 
			
		||||
		-Wno-long-long \
 | 
			
		||||
		-Wno-namespaces                                      \
 | 
			
		||||
		-Wno-padded \
 | 
			
		||||
		-Wno-switch-enum \
 | 
			
		||||
		-Wno-system-headers \
 | 
			
		||||
		-Wno-templates \
 | 
			
		||||
		-Wno-undef \
 | 
			
		||||
		-Wnarrowing                                       \
 | 
			
		||||
		-Wno-noexcept                                        \
 | 
			
		||||
		-Wnoexcept-type                                   \
 | 
			
		||||
		-Wnon-template-friend                             \
 | 
			
		||||
| 
						 | 
				
			
			@ -243,7 +269,7 @@ pedantic_gcc:
 | 
			
		|||
		-Wnonnull                                         \
 | 
			
		||||
		-Wnonnull-compare                                 \
 | 
			
		||||
		-Wnonportable-cfstrings                           \
 | 
			
		||||
		-Wnormalized \
 | 
			
		||||
		-Wnormalized=nfkc                                 \
 | 
			
		||||
		-Wnull-dereference                                \
 | 
			
		||||
		-Wodr                                             \
 | 
			
		||||
		-Wold-style-cast                                  \
 | 
			
		||||
| 
						 | 
				
			
			@ -254,6 +280,7 @@ pedantic_gcc:
 | 
			
		|||
		-Wpacked                                          \
 | 
			
		||||
		-Wpacked-bitfield-compat                          \
 | 
			
		||||
		-Wpacked-not-aligned                              \
 | 
			
		||||
		-Wno-padded                                          \
 | 
			
		||||
		-Wparentheses                                     \
 | 
			
		||||
		-Wpedantic                                        \
 | 
			
		||||
		-Wpessimizing-move                                \
 | 
			
		||||
| 
						 | 
				
			
			@ -266,6 +293,7 @@ pedantic_gcc:
 | 
			
		|||
		-Wpsabi                                           \
 | 
			
		||||
		-Wredundant-decls                                 \
 | 
			
		||||
		-Wredundant-move                                  \
 | 
			
		||||
		-Wredundant-tags                                  \
 | 
			
		||||
		-Wregister                                        \
 | 
			
		||||
		-Wreorder                                         \
 | 
			
		||||
		-Wrestrict                                        \
 | 
			
		||||
| 
						 | 
				
			
			@ -273,9 +301,6 @@ pedantic_gcc:
 | 
			
		|||
		-Wreturn-type                                     \
 | 
			
		||||
		-Wscalar-storage-order                            \
 | 
			
		||||
		-Wsequence-point                                  \
 | 
			
		||||
		-Wshadow \
 | 
			
		||||
		-Wshadow-compatible-local \
 | 
			
		||||
		-Wshadow-local \
 | 
			
		||||
		-Wshadow=compatible-local                         \
 | 
			
		||||
		-Wshadow=global                                   \
 | 
			
		||||
		-Wshadow=local                                    \
 | 
			
		||||
| 
						 | 
				
			
			@ -291,9 +316,13 @@ pedantic_gcc:
 | 
			
		|||
		-Wsizeof-pointer-div                              \
 | 
			
		||||
		-Wsizeof-pointer-memaccess                        \
 | 
			
		||||
		-Wstack-protector                                 \
 | 
			
		||||
		-Wstrict-aliasing                                 \
 | 
			
		||||
		-Wstrict-aliasing=3                               \
 | 
			
		||||
		-Wstrict-null-sentinel                            \
 | 
			
		||||
		-Wstrict-overflow                                 \
 | 
			
		||||
		-Wstrict-overflow=5                               \
 | 
			
		||||
		-Wstring-compare                                  \
 | 
			
		||||
		-Wstringop-overflow                               \
 | 
			
		||||
		-Wstringop-overflow=4                             \
 | 
			
		||||
		-Wstringop-truncation                             \
 | 
			
		||||
		-Wsubobject-linkage                               \
 | 
			
		||||
| 
						 | 
				
			
			@ -309,14 +338,19 @@ pedantic_gcc:
 | 
			
		|||
		-Wswitch                                          \
 | 
			
		||||
		-Wswitch-bool                                     \
 | 
			
		||||
		-Wswitch-default                                  \
 | 
			
		||||
		-Wno-switch-enum                                     \
 | 
			
		||||
		-Wswitch-outside-range                            \
 | 
			
		||||
		-Wswitch-unreachable                              \
 | 
			
		||||
		-Wsync-nand                                       \
 | 
			
		||||
		-Wsynth                                           \
 | 
			
		||||
		-Wno-system-headers                                  \
 | 
			
		||||
		-Wtautological-compare                            \
 | 
			
		||||
		-Wno-templates                                       \
 | 
			
		||||
		-Wterminate                                       \
 | 
			
		||||
		-Wtrampolines                                     \
 | 
			
		||||
		-Wtrigraphs                                       \
 | 
			
		||||
		-Wtype-limits                                     \
 | 
			
		||||
		-Wundef                                           \
 | 
			
		||||
		-Wuninitialized                                   \
 | 
			
		||||
		-Wunknown-pragmas                                 \
 | 
			
		||||
		-Wunreachable-code                                \
 | 
			
		||||
| 
						 | 
				
			
			@ -340,10 +374,12 @@ pedantic_gcc:
 | 
			
		|||
		-Wvirtual-inheritance                             \
 | 
			
		||||
		-Wvirtual-move-assign                             \
 | 
			
		||||
		-Wvla                                             \
 | 
			
		||||
		-Wvolatile                                        \
 | 
			
		||||
		-Wvolatile-register-var                           \
 | 
			
		||||
		-Wwrite-strings                                   \
 | 
			
		||||
		-Wzero-as-null-pointer-constant                   \
 | 
			
		||||
		" cmake -S . -B build_pedantic -GNinja -DCMAKE_BUILD_TYPE=Debug -DJSON_MultipleHeaders=ON
 | 
			
		||||
		-Wzero-length-bounds                              \
 | 
			
		||||
		" cmake -S . -B build_pedantic -GNinja -DCMAKE_BUILD_TYPE=Debug -DJSON_MultipleHeaders=ON -DJSON_BuildTests=On
 | 
			
		||||
	cmake --build build_pedantic
 | 
			
		||||
 | 
			
		||||
##########################################################################
 | 
			
		||||
| 
						 | 
				
			
			@ -353,7 +389,7 @@ pedantic_gcc:
 | 
			
		|||
run_benchmarks:
 | 
			
		||||
	rm -fr build_benchmarks
 | 
			
		||||
	mkdir build_benchmarks
 | 
			
		||||
	cd build_benchmarks ; cmake ../benchmarks -GNinja -DCMAKE_BUILD_TYPE=Release
 | 
			
		||||
	cd build_benchmarks ; cmake ../benchmarks -GNinja -DCMAKE_BUILD_TYPE=Release -DJSON_BuildTests=On
 | 
			
		||||
	cd build_benchmarks ; ninja
 | 
			
		||||
	cd build_benchmarks ; ./json_benchmarks
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -430,7 +466,7 @@ cppcheck:
 | 
			
		|||
clang_analyze:
 | 
			
		||||
	rm -fr clang_analyze_build
 | 
			
		||||
	mkdir clang_analyze_build
 | 
			
		||||
	cd clang_analyze_build ; CCC_CXX=$(COMPILER_DIR)/clang++ CXX=$(COMPILER_DIR)/clang++ $(COMPILER_DIR)/scan-build cmake .. -GNinja
 | 
			
		||||
	cd clang_analyze_build ; CCC_CXX=$(COMPILER_DIR)/clang++ CXX=$(COMPILER_DIR)/clang++ $(COMPILER_DIR)/scan-build cmake .. -GNinja -DJSON_BuildTests=On
 | 
			
		||||
	cd clang_analyze_build ; \
 | 
			
		||||
		$(COMPILER_DIR)/scan-build \
 | 
			
		||||
			-enable-checker alpha.core.BoolAssignment,alpha.core.CallAndMessageUnInitRefArg,alpha.core.CastSize,alpha.core.CastToStruct,alpha.core.Conversion,alpha.core.DynamicTypeChecker,alpha.core.FixedAddr,alpha.core.PointerArithm,alpha.core.PointerSub,alpha.core.SizeofPtr,alpha.core.StackAddressAsyncEscape,alpha.core.TestAfterDivZero,alpha.deadcode.UnreachableCode,core.builtin.BuiltinFunctions,core.builtin.NoReturnFunctions,core.CallAndMessage,core.DivideZero,core.DynamicTypePropagation,core.NonnilStringConstants,core.NonNullParamChecker,core.NullDereference,core.StackAddressEscape,core.UndefinedBinaryOperatorResult,core.uninitialized.ArraySubscript,core.uninitialized.Assign,core.uninitialized.Branch,core.uninitialized.CapturedBlockVariable,core.uninitialized.UndefReturn,core.VLASize,cplusplus.InnerPointer,cplusplus.Move,cplusplus.NewDelete,cplusplus.NewDeleteLeaks,cplusplus.SelfAssignment,deadcode.DeadStores,nullability.NullableDereferenced,nullability.NullablePassedToNonnull,nullability.NullableReturnedFromNonnull,nullability.NullPassedToNonnull,nullability.NullReturnedFromNonnull \
 | 
			
		||||
| 
						 | 
				
			
			@ -472,7 +508,7 @@ oclint:
 | 
			
		|||
clang_sanitize:
 | 
			
		||||
	rm -fr clang_sanitize_build
 | 
			
		||||
	mkdir clang_sanitize_build
 | 
			
		||||
	cd clang_sanitize_build ; CXX=$(COMPILER_DIR)/clang++ cmake .. -DJSON_Sanitizer=On -DJSON_MultipleHeaders=ON -GNinja
 | 
			
		||||
	cd clang_sanitize_build ; CXX=$(COMPILER_DIR)/clang++ cmake .. -DJSON_Sanitizer=On -DJSON_MultipleHeaders=ON -DJSON_BuildTests=On -GNinja
 | 
			
		||||
	cd clang_sanitize_build ; ninja
 | 
			
		||||
	cd clang_sanitize_build ; ctest -j10
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										80
									
								
								README.md
									
										
									
									
									
								
							
							
						
						
									
										80
									
								
								README.md
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -12,13 +12,13 @@
 | 
			
		|||
[](https://lgtm.com/projects/g/nlohmann/json/context:cpp)
 | 
			
		||||
[](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:json)
 | 
			
		||||
[](https://wandbox.org/permlink/3lCHrFUZANONKv7a)
 | 
			
		||||
[](http://nlohmann.github.io/json)
 | 
			
		||||
[](https://nlohmann.github.io/json/doxygen/index.html)
 | 
			
		||||
[](https://raw.githubusercontent.com/nlohmann/json/master/LICENSE.MIT)
 | 
			
		||||
[](https://app.fossa.com/projects/git%2Bgithub.com%2Fnlohmann%2Fjson?ref=badge_shield)
 | 
			
		||||
[](https://github.com/nlohmann/json/releases)
 | 
			
		||||
[](https://github.com/nlohmann/json/releases)
 | 
			
		||||
[](http://github.com/nlohmann/json/issues)
 | 
			
		||||
[](http://isitmaintained.com/project/nlohmann/json "Average time to resolve an issue")
 | 
			
		||||
[](https://github.com/nlohmann/json/issues)
 | 
			
		||||
[](https://isitmaintained.com/project/nlohmann/json "Average time to resolve an issue")
 | 
			
		||||
[](https://bestpractices.coreinfrastructure.org/projects/289)
 | 
			
		||||
[](https://github.com/sponsors/nlohmann)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -55,7 +55,7 @@ There are myriads of [JSON](https://json.org) libraries out there, and each may
 | 
			
		|||
 | 
			
		||||
- **Trivial integration**. Our whole code consists of a single header file [`json.hpp`](https://github.com/nlohmann/json/blob/develop/single_include/nlohmann/json.hpp). That's it. No library, no subproject, no dependencies, no complex build system. The class is written in vanilla C++11. All in all, everything should require no adjustment of your compiler flags or project settings.
 | 
			
		||||
 | 
			
		||||
- **Serious testing**. Our class is heavily [unit-tested](https://github.com/nlohmann/json/tree/develop/test/src) and covers [100%](https://coveralls.io/r/nlohmann/json) of the code, including all exceptional behavior. Furthermore, we checked with [Valgrind](http://valgrind.org) and the [Clang Sanitizers](https://clang.llvm.org/docs/index.html) that there are no memory leaks. [Google OSS-Fuzz](https://github.com/google/oss-fuzz/tree/master/projects/json) additionally runs fuzz tests against all parsers 24/7, effectively executing billions of tests so far. To maintain high quality, the project is following the [Core Infrastructure Initiative (CII) best practices](https://bestpractices.coreinfrastructure.org/projects/289).
 | 
			
		||||
- **Serious testing**. Our class is heavily [unit-tested](https://github.com/nlohmann/json/tree/develop/test/src) and covers [100%](https://coveralls.io/r/nlohmann/json) of the code, including all exceptional behavior. Furthermore, we checked with [Valgrind](https://valgrind.org) and the [Clang Sanitizers](https://clang.llvm.org/docs/index.html) that there are no memory leaks. [Google OSS-Fuzz](https://github.com/google/oss-fuzz/tree/master/projects/json) additionally runs fuzz tests against all parsers 24/7, effectively executing billions of tests so far. To maintain high quality, the project is following the [Core Infrastructure Initiative (CII) best practices](https://bestpractices.coreinfrastructure.org/projects/289).
 | 
			
		||||
 | 
			
		||||
Other aspects were not so important to us:
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -148,7 +148,7 @@ Example:
 | 
			
		|||
include(FetchContent)
 | 
			
		||||
 | 
			
		||||
FetchContent_Declare(json
 | 
			
		||||
  GIT_REPOSITORY https://github.com/nlohmann/json
 | 
			
		||||
  GIT_REPOSITORY https://github.com/nlohmann/json.git
 | 
			
		||||
  GIT_TAG v3.7.3)
 | 
			
		||||
 | 
			
		||||
FetchContent_GetProperties(json)
 | 
			
		||||
| 
						 | 
				
			
			@ -199,9 +199,9 @@ endif()
 | 
			
		|||
 | 
			
		||||
### Package Managers
 | 
			
		||||
 | 
			
		||||
:beer: If you are using OS X and [Homebrew](http://brew.sh), just type `brew tap nlohmann/json` and `brew install nlohmann-json` and you're set. If you want the bleeding edge rather than the latest release, use `brew install nlohmann-json --HEAD`.
 | 
			
		||||
:beer: If you are using OS X and [Homebrew](https://brew.sh), just type `brew tap nlohmann/json` and `brew install nlohmann-json` and you're set. If you want the bleeding edge rather than the latest release, use `brew install nlohmann-json --HEAD`.
 | 
			
		||||
 | 
			
		||||
If you are using the [Meson Build System](http://mesonbuild.com), add this source tree as a [meson subproject](https://mesonbuild.com/Subprojects.html#using-a-subproject). You may also use the `include.zip` published in this project's [Releases](https://github.com/nlohmann/json/releases) to reduce the size of the vendored source tree. Alternatively, you can get a wrap file by downloading it from [Meson WrapDB](https://wrapdb.mesonbuild.com/nlohmann_json), or simply use `meson wrap install nlohmann_json`. Please see the meson project for any issues regarding the packaging.
 | 
			
		||||
If you are using the [Meson Build System](https://mesonbuild.com), add this source tree as a [meson subproject](https://mesonbuild.com/Subprojects.html#using-a-subproject). You may also use the `include.zip` published in this project's [Releases](https://github.com/nlohmann/json/releases) to reduce the size of the vendored source tree. Alternatively, you can get a wrap file by downloading it from [Meson WrapDB](https://wrapdb.mesonbuild.com/nlohmann_json), or simply use `meson wrap install nlohmann_json`. Please see the meson project for any issues regarding the packaging.
 | 
			
		||||
 | 
			
		||||
The provided meson.build can also be used as an alternative to cmake for installing `nlohmann_json` system-wide in which case a pkg-config file is installed. To use it, simply have your build system require the `nlohmann_json` pkg-config dependency. In Meson, it is preferred to use the [`dependency()`](https://mesonbuild.com/Reference-manual.html#dependency) object with a subproject fallback, rather than using the subproject directly.
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -215,7 +215,7 @@ If you are using [Buckaroo](https://buckaroo.pm), you can install this library's
 | 
			
		|||
 | 
			
		||||
If you are using [vcpkg](https://github.com/Microsoft/vcpkg/) on your project for external dependencies, then you can use the [nlohmann-json package](https://github.com/Microsoft/vcpkg/tree/master/ports/nlohmann-json). Please see the vcpkg project for any issues regarding the packaging.
 | 
			
		||||
 | 
			
		||||
If you are using [cget](http://cget.readthedocs.io/en/latest/), you can install the latest development version with `cget install nlohmann/json`. A specific version can be installed with `cget install nlohmann/json@v3.1.0`. Also, the multiple header version can be installed by adding the `-DJSON_MultipleHeaders=ON` flag (i.e., `cget install nlohmann/json -DJSON_MultipleHeaders=ON`).
 | 
			
		||||
If you are using [cget](https://cget.readthedocs.io/en/latest/), you can install the latest development version with `cget install nlohmann/json`. A specific version can be installed with `cget install nlohmann/json@v3.1.0`. Also, the multiple header version can be installed by adding the `-DJSON_MultipleHeaders=ON` flag (i.e., `cget install nlohmann/json -DJSON_MultipleHeaders=ON`).
 | 
			
		||||
 | 
			
		||||
If you are using [CocoaPods](https://cocoapods.org), you can use the library by adding pod `"nlohmann_json", '~>3.1.2'` to your podfile (see [an example](https://bitbucket.org/benman/nlohmann_json-cocoapod/src/master/)). Please file issues [here](https://bitbucket.org/benman/nlohmann_json-cocoapod/issues?status=new&status=open).
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -223,12 +223,12 @@ If you are using [NuGet](https://www.nuget.org), you can use the package [nlohma
 | 
			
		|||
 | 
			
		||||
If you are using [conda](https://conda.io/), you can use the package [nlohmann_json](https://github.com/conda-forge/nlohmann_json-feedstock) from [conda-forge](https://conda-forge.org) executing `conda install -c conda-forge nlohmann_json`. Please file issues [here](https://github.com/conda-forge/nlohmann_json-feedstock/issues).
 | 
			
		||||
 | 
			
		||||
If you are using [MSYS2](http://www.msys2.org/), your can use the [mingw-w64-nlohmann-json](https://packages.msys2.org/base/mingw-w64-nlohmann-json) package, just type `pacman -S mingw-w64-i686-nlohmann-json` or `pacman -S mingw-w64-x86_64-nlohmann-json` for installation. Please file issues [here](https://github.com/msys2/MINGW-packages/issues/new?title=%5Bnlohmann-json%5D) if you experience problems with the packages.
 | 
			
		||||
If you are using [MSYS2](https://www.msys2.org/), your can use the [mingw-w64-nlohmann-json](https://packages.msys2.org/base/mingw-w64-nlohmann-json) package, just type `pacman -S mingw-w64-i686-nlohmann-json` or `pacman -S mingw-w64-x86_64-nlohmann-json` for installation. Please file issues [here](https://github.com/msys2/MINGW-packages/issues/new?title=%5Bnlohmann-json%5D) if you experience problems with the packages.
 | 
			
		||||
 | 
			
		||||
If you are using [`build2`](https://build2.org), you can use the [`nlohmann-json`](https://cppget.org/nlohmann-json) package from the public repository http://cppget.org or directly from the [package's sources repository](https://github.com/build2-packaging/nlohmann-json). In your project's `manifest` file, just add `depends: nlohmann-json` (probably with some [version constraints](https://build2.org/build2-toolchain/doc/build2-toolchain-intro.xhtml#guide-add-remove-deps)). If you are not familiar with using dependencies in `build2`, [please read this introduction](https://build2.org/build2-toolchain/doc/build2-toolchain-intro.xhtml).
 | 
			
		||||
If you are using [`build2`](https://build2.org), you can use the [`nlohmann-json`](https://cppget.org/nlohmann-json) package from the public repository https://cppget.org or directly from the [package's sources repository](https://github.com/build2-packaging/nlohmann-json). In your project's `manifest` file, just add `depends: nlohmann-json` (probably with some [version constraints](https://build2.org/build2-toolchain/doc/build2-toolchain-intro.xhtml#guide-add-remove-deps)). If you are not familiar with using dependencies in `build2`, [please read this introduction](https://build2.org/build2-toolchain/doc/build2-toolchain-intro.xhtml).
 | 
			
		||||
Please file issues [here](https://github.com/build2-packaging/nlohmann-json) if you experience problems with the packages.
 | 
			
		||||
 | 
			
		||||
If you are using [`wsjcpp`](http://wsjcpp.org), you can use the command `wsjcpp install "https://github.com/nlohmann/json:develop"` to get the latest version. Note you can change the branch ":develop" to an existing tag or another branch.
 | 
			
		||||
If you are using [`wsjcpp`](https://wsjcpp.org), you can use the command `wsjcpp install "https://github.com/nlohmann/json:develop"` to get the latest version. Note you can change the branch ":develop" to an existing tag or another branch.
 | 
			
		||||
 | 
			
		||||
## Examples
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1016,7 +1016,7 @@ Other Important points:
 | 
			
		|||
 | 
			
		||||
### Binary formats (BSON, CBOR, MessagePack, and UBJSON)
 | 
			
		||||
 | 
			
		||||
Though JSON is a ubiquitous data format, it is not a very compact format suitable for data exchange, for instance over a network. Hence, the library supports [BSON](http://bsonspec.org) (Binary JSON), [CBOR](http://cbor.io) (Concise Binary Object Representation), [MessagePack](http://msgpack.org), and [UBJSON](http://ubjson.org) (Universal Binary JSON Specification) to efficiently encode JSON values to byte vectors and to decode such vectors.
 | 
			
		||||
Though JSON is a ubiquitous data format, it is not a very compact format suitable for data exchange, for instance over a network. Hence, the library supports [BSON](http://bsonspec.org) (Binary JSON), [CBOR](https://cbor.io) (Concise Binary Object Representation), [MessagePack](https://msgpack.org), and [UBJSON](http://ubjson.org) (Universal Binary JSON Specification) to efficiently encode JSON values to byte vectors and to decode such vectors.
 | 
			
		||||
 | 
			
		||||
```cpp
 | 
			
		||||
// create a JSON value
 | 
			
		||||
| 
						 | 
				
			
			@ -1112,7 +1112,7 @@ Please note:
 | 
			
		|||
 | 
			
		||||
    The code compiles successfully with [Android NDK](https://developer.android.com/ndk/index.html?hl=ml), Revision 9 - 11 (and possibly later) and [CrystaX's Android NDK](https://www.crystax.net/en/android/ndk) version 10.
 | 
			
		||||
 | 
			
		||||
- For GCC running on MinGW or Android SDK, the error `'to_string' is not a member of 'std'` (or similarly, for `strtod` or `strtof`) may occur. Note this is not an issue with the code,  but rather with the compiler itself. On Android, see above to build with a newer environment.  For MinGW, please refer to [this site](http://tehsausage.com/mingw-to-string) and [this discussion](https://github.com/nlohmann/json/issues/136) for information on how to fix this bug. For Android NDK using `APP_STL := gnustl_static`, please refer to [this discussion](https://github.com/nlohmann/json/issues/219).
 | 
			
		||||
- For GCC running on MinGW or Android SDK, the error `'to_string' is not a member of 'std'` (or similarly, for `strtod` or `strtof`) may occur. Note this is not an issue with the code,  but rather with the compiler itself. On Android, see above to build with a newer environment.  For MinGW, please refer to [this site](https://tehsausage.com/mingw-to-string) and [this discussion](https://github.com/nlohmann/json/issues/136) for information on how to fix this bug. For Android NDK using `APP_STL := gnustl_static`, please refer to [this discussion](https://github.com/nlohmann/json/issues/219).
 | 
			
		||||
 | 
			
		||||
- Unsupported versions of GCC and Clang are rejected by `#error` directives. This can be switched off by defining `JSON_SKIP_UNSUPPORTED_COMPILER_CHECK`. Note that you can expect no support in this case.
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1169,11 +1169,11 @@ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR I
 | 
			
		|||
 | 
			
		||||
* * *
 | 
			
		||||
 | 
			
		||||
The class contains the UTF-8 Decoder from Bjoern Hoehrmann which is licensed under the [MIT License](http://opensource.org/licenses/MIT) (see above). Copyright © 2008-2009 [Björn Hoehrmann](http://bjoern.hoehrmann.de/) <bjoern@hoehrmann.de>
 | 
			
		||||
The class contains the UTF-8 Decoder from Bjoern Hoehrmann which is licensed under the [MIT License](http://opensource.org/licenses/MIT) (see above). Copyright © 2008-2009 [Björn Hoehrmann](https://bjoern.hoehrmann.de/) <bjoern@hoehrmann.de>
 | 
			
		||||
 | 
			
		||||
The class contains a slightly modified version of the Grisu2 algorithm from Florian Loitsch which is licensed under the [MIT License](http://opensource.org/licenses/MIT) (see above). Copyright © 2009 [Florian Loitsch](http://florian.loitsch.com/)
 | 
			
		||||
The class contains a slightly modified version of the Grisu2 algorithm from Florian Loitsch which is licensed under the [MIT License](http://opensource.org/licenses/MIT) (see above). Copyright © 2009 [Florian Loitsch](https://florian.loitsch.com/)
 | 
			
		||||
 | 
			
		||||
The class contains a copy of [Hedley](https://nemequ.github.io/hedley/) from Evan Nemerson which is licensed as [CC0-1.0](http://creativecommons.org/publicdomain/zero/1.0/).
 | 
			
		||||
The class contains a copy of [Hedley](https://nemequ.github.io/hedley/) from Evan Nemerson which is licensed as [CC0-1.0](https://creativecommons.org/publicdomain/zero/1.0/).
 | 
			
		||||
 | 
			
		||||
## Contact
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1230,7 +1230,7 @@ I deeply appreciate the help of the following people.
 | 
			
		|||
- [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.
 | 
			
		||||
- [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.
 | 
			
		||||
- [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.
 | 
			
		||||
- [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`.
 | 
			
		||||
| 
						 | 
				
			
			@ -1374,6 +1374,36 @@ I deeply appreciate the help of the following people.
 | 
			
		|||
- [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`.
 | 
			
		||||
- [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.
 | 
			
		||||
- [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.
 | 
			
		||||
- [Alex](https://github.com/gistrec) fixed an MSVC warning.
 | 
			
		||||
- [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.
 | 
			
		||||
- [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.
 | 
			
		||||
- [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.
 | 
			
		||||
- [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.
 | 
			
		||||
- [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.
 | 
			
		||||
- [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.
 | 
			
		||||
- [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.
 | 
			
		||||
- [jothepro](https://github.com/jothepro) updated links to the Hunter package.
 | 
			
		||||
- [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.
 | 
			
		||||
- [Paul Jurczak](https://github.com/pauljurczak) fixed an example in the README.
 | 
			
		||||
- [Sonu Lohani](https://github.com/sonulohani) fixed a warning.
 | 
			
		||||
- [Carlos Gomes Martinho](https://github.com/gocarlos) updated the Conan package source.
 | 
			
		||||
- [Konstantin Podsvirov](https://github.com/podsvirov) fixed the MSYS2 package documentation.
 | 
			
		||||
- [Tridacnid](https://github.com/Tridacnid) improved the CMake tests.
 | 
			
		||||
- [Michael](https://github.com/MBalszun) fixed MSVC warnings.
 | 
			
		||||
- [Quentin Barbarat](https://github.com/quentin-dev) fixed an example in the documentation.
 | 
			
		||||
- [XyFreak](https://github.com/XyFreak) fixed a compiler warning.
 | 
			
		||||
- [TotalCaesar659](https://github.com/TotalCaesar659) fixed links in the README.
 | 
			
		||||
 | 
			
		||||
Thanks a lot for helping out! Please [let me know](mailto:mail@nlohmann.me) if I forgot someone.
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1383,10 +1413,10 @@ Thanks a lot for helping out! Please [let me know](mailto:mail@nlohmann.me) if I
 | 
			
		|||
The library itself consists of a single header file licensed under the MIT license. However, it is built, tested, documented, and whatnot using a lot of third-party tools and services. Thanks a lot!
 | 
			
		||||
 | 
			
		||||
- [**amalgamate.py - Amalgamate C source and header files**](https://github.com/edlund/amalgamate) to create a single header file
 | 
			
		||||
- [**American fuzzy lop**](http://lcamtuf.coredump.cx/afl/) for fuzz testing
 | 
			
		||||
- [**American fuzzy lop**](https://lcamtuf.coredump.cx/afl/) for fuzz testing
 | 
			
		||||
- [**AppVeyor**](https://www.appveyor.com) for [continuous integration](https://ci.appveyor.com/project/nlohmann/json) on Windows
 | 
			
		||||
- [**Artistic Style**](http://astyle.sourceforge.net) for automatic source code indentation
 | 
			
		||||
- [**CircleCI**](http://circleci.com) for [continuous integration](https://circleci.com/gh/nlohmann/json).
 | 
			
		||||
- [**CircleCI**](https://circleci.com) for [continuous integration](https://circleci.com/gh/nlohmann/json).
 | 
			
		||||
- [**Clang**](https://clang.llvm.org) for compilation with code sanitizers
 | 
			
		||||
- [**CMake**](https://cmake.org) for build automation
 | 
			
		||||
- [**Codacity**](https://www.codacy.com) for further [code analysis](https://www.codacy.com/app/nlohmann/json)
 | 
			
		||||
| 
						 | 
				
			
			@ -1394,19 +1424,19 @@ The library itself consists of a single header file licensed under the MIT licen
 | 
			
		|||
- [**Coverity Scan**](https://scan.coverity.com) for [static analysis](https://scan.coverity.com/projects/nlohmann-json)
 | 
			
		||||
- [**cppcheck**](http://cppcheck.sourceforge.net) for static analysis
 | 
			
		||||
- [**doctest**](https://github.com/onqtam/doctest) for the unit tests
 | 
			
		||||
- [**Doxygen**](http://www.stack.nl/~dimitri/doxygen/) to generate [documentation](https://nlohmann.github.io/json/)
 | 
			
		||||
- [**Doxygen**](https://www.doxygen.nl/index.html) to generate [documentation](https://nlohmann.github.io/json/doxygen/index.html)
 | 
			
		||||
- [**git-update-ghpages**](https://github.com/rstacruz/git-update-ghpages) to upload the documentation to gh-pages
 | 
			
		||||
- [**GitHub Changelog Generator**](https://github.com/skywinder/github-changelog-generator) to generate the [ChangeLog](https://github.com/nlohmann/json/blob/develop/ChangeLog.md)
 | 
			
		||||
- [**Google Benchmark**](https://github.com/google/benchmark) to implement the benchmarks
 | 
			
		||||
- [**Hedley**](https://nemequ.github.io/hedley/) to avoid re-inventing several compiler-agnostic feature macros
 | 
			
		||||
- [**lcov**](http://ltp.sourceforge.net/coverage/lcov.php) to process coverage information and create a HTML view
 | 
			
		||||
- [**libFuzzer**](http://llvm.org/docs/LibFuzzer.html) to implement fuzz testing for OSS-Fuzz
 | 
			
		||||
- [**libFuzzer**](https://llvm.org/docs/LibFuzzer.html) to implement fuzz testing for OSS-Fuzz
 | 
			
		||||
- [**OSS-Fuzz**](https://github.com/google/oss-fuzz) for continuous fuzz testing of the library ([project repository](https://github.com/google/oss-fuzz/tree/master/projects/json))
 | 
			
		||||
- [**Probot**](https://probot.github.io) for automating maintainer tasks such as closing stale issues, requesting missing information, or detecting toxic comments.
 | 
			
		||||
- [**send_to_wandbox**](https://github.com/nlohmann/json/blob/develop/doc/scripts/send_to_wandbox.py) to send code examples to [Wandbox](http://melpon.org/wandbox)
 | 
			
		||||
- [**Travis**](https://travis-ci.org) for [continuous integration](https://travis-ci.org/nlohmann/json) on Linux and macOS
 | 
			
		||||
- [**Valgrind**](http://valgrind.org) to check for correct memory management
 | 
			
		||||
- [**Wandbox**](http://melpon.org/wandbox) for [online examples](https://wandbox.org/permlink/3lCHrFUZANONKv7a)
 | 
			
		||||
- [**Valgrind**](https://valgrind.org) to check for correct memory management
 | 
			
		||||
- [**Wandbox**](https://wandbox.org) for [online examples](https://wandbox.org/permlink/3lCHrFUZANONKv7a)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## Projects using JSON for Modern C++
 | 
			
		||||
| 
						 | 
				
			
			@ -1423,7 +1453,7 @@ The library supports **Unicode input** as follows:
 | 
			
		|||
- Only **UTF-8** encoded input is supported which is the default encoding for JSON according to [RFC 8259](https://tools.ietf.org/html/rfc8259.html#section-8.1).
 | 
			
		||||
- `std::u16string` and `std::u32string` can be parsed, assuming UTF-16 and UTF-32 encoding, respectively. These encodings are not supported when reading from files or other input containers.
 | 
			
		||||
- Other encodings such as Latin-1 or ISO 8859-1 are **not** supported and will yield parse or serialization errors.
 | 
			
		||||
- [Unicode noncharacters](http://www.unicode.org/faq/private_use.html#nonchar1) will not be replaced by the library.
 | 
			
		||||
- [Unicode noncharacters](https://www.unicode.org/faq/private_use.html#nonchar1) will not be replaced by the library.
 | 
			
		||||
- Invalid surrogates (e.g., incomplete pairs such as `\uDEAD`) will yield parse errors.
 | 
			
		||||
- The strings stored in the library are UTF-8 encoded. When using the default string type (`std::string`), note that its length/size functions return the number of stored bytes rather than the number of characters or glyphs.
 | 
			
		||||
- When you store strings with different encodings in the library, calling [`dump()`](https://nlohmann.github.io/json/classnlohmann_1_1basic__json_a50ec80b02d0f3f51130d4abb5d1cfdc5.html#a50ec80b02d0f3f51130d4abb5d1cfdc5) may throw an exception unless `json::error_handler_t::replace` or `json::error_handler_t::ignore` are used as error handlers.
 | 
			
		||||
| 
						 | 
				
			
			@ -1474,7 +1504,7 @@ To compile and run the tests, you need to execute
 | 
			
		|||
```sh
 | 
			
		||||
$ mkdir build
 | 
			
		||||
$ cd build
 | 
			
		||||
$ cmake ..
 | 
			
		||||
$ cmake .. -DJSON_BuildTests=On
 | 
			
		||||
$ cmake --build .
 | 
			
		||||
$ ctest --output-on-failure
 | 
			
		||||
```
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -112,7 +112,7 @@ before_build:
 | 
			
		|||
  # for with_win_header build, inject the inclusion of Windows.h to the single-header library
 | 
			
		||||
  - ps: if ($env:name -Eq "with_win_header") { $header_path = "single_include\nlohmann\json.hpp" }
 | 
			
		||||
  - ps: if ($env:name -Eq "with_win_header") { "#include <Windows.h>`n" + (Get-Content $header_path | Out-String) | Set-Content $header_path }
 | 
			
		||||
  - if "%GENERATOR%"=="Ninja" (cmake . -G "%GENERATOR%" -DCMAKE_BUILD_TYPE="%configuration%" -DCMAKE_CXX_FLAGS="%CXX_FLAGS%" -DCMAKE_EXE_LINKER_FLAGS="%LINKER_FLAGS%" -DCMAKE_IGNORE_PATH="C:/Program Files/Git/usr/bin") else (cmake . -G "%GENERATOR%" -A "%GENERATOR_PLATFORM%" -DCMAKE_CXX_FLAGS="%CXX_FLAGS%" -DCMAKE_EXE_LINKER_FLAGS="%LINKER_FLAGS%" -DCMAKE_IGNORE_PATH="C:/Program Files/Git/usr/bin")
 | 
			
		||||
  - if "%GENERATOR%"=="Ninja" (cmake . -G "%GENERATOR%" -DCMAKE_BUILD_TYPE="%configuration%" -DCMAKE_CXX_FLAGS="%CXX_FLAGS%" -DCMAKE_EXE_LINKER_FLAGS="%LINKER_FLAGS%" -DCMAKE_IGNORE_PATH="C:/Program Files/Git/usr/bin" -DJSON_BuildTests=On) else (cmake . -G "%GENERATOR%" -A "%GENERATOR_PLATFORM%" -DCMAKE_CXX_FLAGS="%CXX_FLAGS%" -DCMAKE_EXE_LINKER_FLAGS="%LINKER_FLAGS%" -DCMAKE_IGNORE_PATH="C:/Program Files/Git/usr/bin" -DJSON_BuildTests=On)
 | 
			
		||||
 | 
			
		||||
build_script:
 | 
			
		||||
  - cmake --build . --config "%configuration%"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										
											BIN
										
									
								
								doc/avatars.png
									
										
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								doc/avatars.png
									
										
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 Before Width: | Height: | Size: 1 MiB After Width: | Height: | Size: 1.1 MiB  | 
| 
						 | 
				
			
			@ -331,13 +331,14 @@ inline input_stream_adapter input_adapter(std::istream&& stream)
 | 
			
		|||
    return input_stream_adapter(stream);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
template<typename CharT,
 | 
			
		||||
template<typename CharT, typename SizeT,
 | 
			
		||||
         typename std::enable_if<
 | 
			
		||||
             std::is_pointer<CharT>::value and
 | 
			
		||||
             std::is_integral<typename std::remove_pointer<CharT>::type>::value and
 | 
			
		||||
             not std::is_same<SizeT, bool>::value and
 | 
			
		||||
             sizeof(typename std::remove_pointer<CharT>::type) == 1,
 | 
			
		||||
             int>::type = 0>
 | 
			
		||||
input_buffer_adapter input_adapter(CharT b, std::size_t l)
 | 
			
		||||
input_buffer_adapter input_adapter(CharT b, SizeT l)
 | 
			
		||||
{
 | 
			
		||||
    return input_buffer_adapter(reinterpret_cast<const char*>(b), l);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -452,7 +452,7 @@ class json_sax_dom_callback_parser
 | 
			
		|||
        ref_stack.pop_back();
 | 
			
		||||
        keep_stack.pop_back();
 | 
			
		||||
 | 
			
		||||
        if (not ref_stack.empty() and ref_stack.back() and ref_stack.back()->is_object())
 | 
			
		||||
        if (not ref_stack.empty() and ref_stack.back() and ref_stack.back()->is_structured())
 | 
			
		||||
        {
 | 
			
		||||
            // remove discarded value
 | 
			
		||||
            for (auto it = ref_stack.back()->begin(); it != ref_stack.back()->end(); ++it)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1367,7 +1367,7 @@ scan_number_done:
 | 
			
		|||
        std::string result;
 | 
			
		||||
        for (const auto c : token_string)
 | 
			
		||||
        {
 | 
			
		||||
            if ('\x00' <= c and c <= '\x1F')
 | 
			
		||||
            if (static_cast<unsigned char>(c) <= '\x1F')
 | 
			
		||||
            {
 | 
			
		||||
                // escape control characters
 | 
			
		||||
                std::array<char, 9> cs{{}};
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3207,7 +3207,7 @@ class basic_json
 | 
			
		|||
                   not std::is_same<ValueType, typename string_t::value_type>::value and
 | 
			
		||||
                   not detail::is_basic_json<ValueType>::value
 | 
			
		||||
                   and not std::is_same<ValueType, std::initializer_list<typename string_t::value_type>>::value
 | 
			
		||||
#if defined(JSON_HAS_CPP_17) && (defined(__GNUC__) || (defined(_MSC_VER) and _MSC_VER <= 1914))
 | 
			
		||||
#if defined(JSON_HAS_CPP_17) && (defined(__GNUC__) || (defined(_MSC_VER) and _MSC_VER >= 1910 and _MSC_VER <= 1914))
 | 
			
		||||
                   and not std::is_same<ValueType, typename std::string_view>::value
 | 
			
		||||
#endif
 | 
			
		||||
                   and detail::is_detected<detail::get_template_function, const basic_json_t&, ValueType>::value
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4753,13 +4753,14 @@ inline input_stream_adapter input_adapter(std::istream&& stream)
 | 
			
		|||
    return input_stream_adapter(stream);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
template<typename CharT,
 | 
			
		||||
template<typename CharT, typename SizeT,
 | 
			
		||||
         typename std::enable_if<
 | 
			
		||||
             std::is_pointer<CharT>::value and
 | 
			
		||||
             std::is_integral<typename std::remove_pointer<CharT>::type>::value and
 | 
			
		||||
             not std::is_same<SizeT, bool>::value and
 | 
			
		||||
             sizeof(typename std::remove_pointer<CharT>::type) == 1,
 | 
			
		||||
             int>::type = 0>
 | 
			
		||||
input_buffer_adapter input_adapter(CharT b, std::size_t l)
 | 
			
		||||
input_buffer_adapter input_adapter(CharT b, SizeT l)
 | 
			
		||||
{
 | 
			
		||||
    return input_buffer_adapter(reinterpret_cast<const char*>(b), l);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -5357,7 +5358,7 @@ class json_sax_dom_callback_parser
 | 
			
		|||
        ref_stack.pop_back();
 | 
			
		||||
        keep_stack.pop_back();
 | 
			
		||||
 | 
			
		||||
        if (not ref_stack.empty() and ref_stack.back() and ref_stack.back()->is_object())
 | 
			
		||||
        if (not ref_stack.empty() and ref_stack.back() and ref_stack.back()->is_structured())
 | 
			
		||||
        {
 | 
			
		||||
            // remove discarded value
 | 
			
		||||
            for (auto it = ref_stack.back()->begin(); it != ref_stack.back()->end(); ++it)
 | 
			
		||||
| 
						 | 
				
			
			@ -9456,7 +9457,7 @@ scan_number_done:
 | 
			
		|||
        std::string result;
 | 
			
		||||
        for (const auto c : token_string)
 | 
			
		||||
        {
 | 
			
		||||
            if ('\x00' <= c and c <= '\x1F')
 | 
			
		||||
            if (static_cast<unsigned char>(c) <= '\x1F')
 | 
			
		||||
            {
 | 
			
		||||
                // escape control characters
 | 
			
		||||
                std::array<char, 9> cs{{}};
 | 
			
		||||
| 
						 | 
				
			
			@ -18999,7 +19000,7 @@ class basic_json
 | 
			
		|||
                   not std::is_same<ValueType, typename string_t::value_type>::value and
 | 
			
		||||
                   not detail::is_basic_json<ValueType>::value
 | 
			
		||||
                   and not std::is_same<ValueType, std::initializer_list<typename string_t::value_type>>::value
 | 
			
		||||
#if defined(JSON_HAS_CPP_17) && (defined(__GNUC__) || (defined(_MSC_VER) and _MSC_VER <= 1914))
 | 
			
		||||
#if defined(JSON_HAS_CPP_17) && (defined(__GNUC__) || (defined(_MSC_VER) and _MSC_VER >= 1910 and _MSC_VER <= 1914))
 | 
			
		||||
                   and not std::is_same<ValueType, typename std::string_view>::value
 | 
			
		||||
#endif
 | 
			
		||||
                   and detail::is_detected<detail::get_template_function, const basic_json_t&, ValueType>::value
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -183,6 +183,7 @@ add_dependencies(json_unit download_test_data)
 | 
			
		|||
#############################################################################
 | 
			
		||||
# Test the generated build configs
 | 
			
		||||
#############################################################################
 | 
			
		||||
 | 
			
		||||
add_subdirectory(cmake_import)
 | 
			
		||||
add_subdirectory(cmake_import_minver)
 | 
			
		||||
add_subdirectory(cmake_add_subdirectory)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1489,6 +1489,18 @@ TEST_CASE("parser class")
 | 
			
		|||
            [1,2,[3,4,5],4,5]
 | 
			
		||||
        )";
 | 
			
		||||
 | 
			
		||||
        auto structured_array = R"(
 | 
			
		||||
            [
 | 
			
		||||
                1,
 | 
			
		||||
                {
 | 
			
		||||
                     "foo": "bar"
 | 
			
		||||
                },
 | 
			
		||||
                {
 | 
			
		||||
                     "qux": "baz"
 | 
			
		||||
                }
 | 
			
		||||
            ]
 | 
			
		||||
        )";
 | 
			
		||||
 | 
			
		||||
        SECTION("filter nothing")
 | 
			
		||||
        {
 | 
			
		||||
            json j_object = json::parse(s_object, [](int, json::parse_event_t, const json&)
 | 
			
		||||
| 
						 | 
				
			
			@ -1557,6 +1569,41 @@ TEST_CASE("parser class")
 | 
			
		|||
            CHECK (j_array == json({1, {3, 4, 5}, 4, 5}));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        SECTION("filter object in array")
 | 
			
		||||
        {
 | 
			
		||||
            json j_filtered1 = json::parse(structured_array, [](int, json::parse_event_t e, const json & parsed)
 | 
			
		||||
            {
 | 
			
		||||
                if (e == json::parse_event_t::object_end and parsed.contains("foo"))
 | 
			
		||||
                {
 | 
			
		||||
                    return false;
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    return true;
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            // the specified object will be discarded, and removed.
 | 
			
		||||
            CHECK (j_filtered1.size() == 2);
 | 
			
		||||
            CHECK (j_filtered1 == json({1, {{"qux", "baz"}}}));
 | 
			
		||||
 | 
			
		||||
            json j_filtered2 = json::parse(structured_array, [](int, json::parse_event_t e, const json & parsed)
 | 
			
		||||
            {
 | 
			
		||||
                if (e == json::parse_event_t::object_end)
 | 
			
		||||
                {
 | 
			
		||||
                    return false;
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    return true;
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            // removed all objects in array.
 | 
			
		||||
            CHECK (j_filtered2.size() == 1);
 | 
			
		||||
            CHECK (j_filtered2 == json({1}));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        SECTION("filter specific events")
 | 
			
		||||
        {
 | 
			
		||||
            SECTION("first closing event")
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1890,6 +1890,28 @@ TEST_CASE("regression tests")
 | 
			
		|||
        json j = val;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    SECTION("issue #1715 - json::from_cbor does not respect allow_exceptions = false when input is string literal")
 | 
			
		||||
    {
 | 
			
		||||
        SECTION("string literal")
 | 
			
		||||
        {
 | 
			
		||||
            json cbor = json::from_cbor("B", true, false);
 | 
			
		||||
            CHECK(cbor.is_discarded());
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        SECTION("string array")
 | 
			
		||||
        {
 | 
			
		||||
            const char input[] = { 'B', 0x00 };
 | 
			
		||||
            json cbor = json::from_cbor(input, true, false);
 | 
			
		||||
            CHECK(cbor.is_discarded());
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        SECTION("std::string")
 | 
			
		||||
        {
 | 
			
		||||
            json cbor = json::from_cbor(std::string("B"), true, false);
 | 
			
		||||
            CHECK(cbor.is_discarded());
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    SECTION("issue #1805 - A pair<T1, T2> is json constructible only if T1 and T2 are json constructible")
 | 
			
		||||
    {
 | 
			
		||||
        static_assert(!std::is_constructible<json, std::pair<std::string, NotSerializableData>>::value, "");
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue