Compare commits

...

1071 Commits

Author SHA1 Message Date
Niels Lohmann
9f81beb5e2 Merge branch 'release/3.0.0' 2017-12-17 11:04:04 +01:00
Niels Lohmann
106f9f5436 ⬆️ updated git-update-ghpages script 2017-12-17 10:20:30 +01:00
Niels Lohmann
9eb5e2c271 🔖 set version to 3.0.0 2017-12-17 08:40:19 +01:00
Niels Lohmann
9e3c4ad11f 🔖 set version to 3.0.0 2017-12-17 08:31:18 +01:00
Niels Lohmann
314e4e7699 📝 improved documentation for dump and iterator_wrapper 2017-12-16 23:58:10 +01:00
Niels Lohmann
9a51fb4da2 🚨 fixed some warnings 2017-12-16 22:19:30 +01:00
Niels Lohmann
7bf007f2bc Merge pull request #879 from nlohmann/feature/algorithms
 re-added tests for algorithms
2017-12-16 12:41:07 +01:00
Niels Lohmann
980795b644 ✏️ fixed typos 2017-12-16 12:37:44 +01:00
Niels Lohmann
f3bd755cab removing <iomanip> header 2017-12-16 12:37:25 +01:00
Niels Lohmann
4c871c58f8 re-added tests for algorithms 2017-12-16 11:16:34 +01:00
Niels Lohmann
c23f5dcea6 📝 fixed year 2017-12-15 23:49:37 +01:00
Niels Lohmann
2e1b1061cd Merge pull request #875 from nlohmann/feature/spelling
Overworked library toward 3.0.0 release
2017-12-14 22:31:19 +01:00
Niels Lohmann
261caec2de 👥 added contributor image 2017-12-14 22:29:39 +01:00
Niels Lohmann
f80827d068 Merge pull request #873 from nlohmann/feature/issue872
🚨 remove C4996 warnings #872
2017-12-14 09:35:48 +01:00
Niels Lohmann
9a70c60fa5 Revert "⬆️ updated to Catch 2.0.1"
This reverts commit 920f64c01c.
2017-12-14 07:49:16 +01:00
Niels Lohmann
fb8482db76 👌 fixed some issues from the last commit #875 2017-12-13 23:44:53 +01:00
Niels Lohmann
920f64c01c ⬆️ updated to Catch 2.0.1
Update required all CHECK_THROWS_AS macros to pass the exception type without reference, because this is now done by Catch2.
2017-12-13 22:18:05 +01:00
Niels Lohmann
293748a9a9 📝 overworked README
- Added recent contributors to thanks list.
- Linked PGP key for private mails.
- Updated compiler list.
2017-12-13 22:17:02 +01:00
Niels Lohmann
e8d9963abe 👌 cosmetic changes and overworked spelling
- All hex literals use upper case letters after the x.
- Fixed sime typos.
- Documented some more functions.
2017-12-13 22:15:53 +01:00
Niels Lohmann
a9a4ff61c6 🚨 remove C4996 warnings #872
These were the remaining direct calls to alloc.
2017-12-13 17:01:39 +01:00
Niels Lohmann
f7ae143a93 Merge pull request #870 from nlohmann/feature/issue838
💥 throwing an exception in case dump encounters a non-UTF-8 string #838
2017-12-13 06:34:11 +01:00
Niels Lohmann
8419bfbbd2 improved test coverage
As we guarantee proper UTF-8 before, we do not need to cope with it later.
2017-12-12 20:44:57 +01:00
Niels Lohmann
569d275f65 💥 throwing an exception in case dump encounters a non-UTF-8 string #838
We had a lot of issues with failing roundtrips (i.e., parse errors from serializations) in case string were stored in the library that were not UTF-8 encoded. This PR adds an exception in this case.
2017-12-11 22:38:05 +01:00
Niels Lohmann
383743c6c0 Merge pull request #868 from nlohmann/feature/issue867
📝 fixing documentation #867
2017-12-11 08:55:26 +01:00
Niels Lohmann
7de009edd1 ✏️ fixing typos #869 2017-12-10 13:07:47 +01:00
Niels Lohmann
772bb3cc20 📝 fixing documentation #867
The example in the documentation on how to "force" an array of arrays was wrong since the first release. Fixed the documentation and added checks for the README unit tests.
2017-12-10 12:32:20 +01:00
Niels Lohmann
0693945230 Merge pull request #860 from bogemic/std_iterator_conformance_cpp17
iter_impl template conformance with C++17
2017-12-08 07:55:47 +01:00
Mike Bogdanov
64d6daa76e iter_impl template conformance with C++17 2017-12-07 11:30:17 +03:00
Niels Lohmann
7c2d4f1852 👷 added Xcode 9.1 and 9.2 2017-12-06 22:32:03 +01:00
Niels Lohmann
9e2f185ac6 💄 reformatted code after PRs 2017-12-06 22:21:11 +01:00
Niels Lohmann
c5e731774a Merge pull request #856 from bogemic/std_allocator_conformance_cpp17
Std allocator conformance cpp17
2017-12-06 21:52:52 +01:00
Niels Lohmann
25d205c16d 📝 clarified difference between serialization and string value retrieval #853 2017-12-06 21:42:36 +01:00
Niels Lohmann
fa76f2efd7 Merge pull request #855 from theodelrieu/fix/cmake_include_directories
cmake: use BUILD_INTERFACE/INSTALL_INTERFACE
2017-12-06 20:47:38 +01:00
Mike Bogdanov
8890b935fd fixed merge conflicts 2017-12-06 12:24:50 +03:00
Mike Bogdanov
daba1b6a0b fixed conformance with C++17, some members of allocator are depricated and should be used via allocator_traits 2017-12-06 11:20:42 +03:00
Niels Lohmann
0e3a0b730b Merge pull request #854 from theodelrieu/fix/force_msvc_stacktrace
to/from_json: add a MSVC-specific static_assert to force a stacktrace
2017-12-05 19:36:31 +01:00
Théo DELRIEU
541ee62a05 cmake: use BUILD_INTERFACE/INSTALL_INTERFACE in target_include_directories 2017-12-05 11:27:03 +01:00
Théo DELRIEU
c9a02cbc59 to/from_json: add a MSVC-specific static_assert to force a stacktrace 2017-12-05 10:52:55 +01:00
Niels Lohmann
f4c01601fa Merge pull request #844 from TinyTinni/develop
Add .natvis for MSVC debug view
2017-12-04 21:43:22 +01:00
Matthias Möller
24fe572d98 missing new line 2017-11-30 13:37:58 +01:00
Matthias Möller
8e9a8792a9 moved natis to root dir 2017-11-30 13:26:45 +01:00
Matthias Möller
af775ddbb8 add compiler & cmake version check 2017-11-28 23:43:39 +01:00
Matthias Möller
48d7a32daa add .natvis for MSVC debug view 2017-11-26 10:31:33 +01:00
Matthias Möller
5b4855dea2 fix targetname 2017-11-26 10:29:51 +01:00
Niels Lohmann
cc937deaf6 🚑 the last commit contained a bug #821 2017-11-26 10:15:23 +01:00
Niels Lohmann
430f03512c 🚨 fixed some warnings #821 2017-11-25 22:06:18 +01:00
Niels Lohmann
ea5aed0769 Merge branch 'feature/to_array' into develop 2017-11-25 19:41:11 +01:00
Niels Lohmann
de75cf89f7 improved test coverage 2017-11-25 19:41:02 +01:00
Niels Lohmann
52ca35b2b0 Merge pull request #829 from jowr/patch-1
Updated hunter package links
2017-11-18 13:35:21 +01:00
Jorrit Wronski
7b8ddadd83 removed hunter badge 2017-11-16 21:01:27 +01:00
Jorrit Wronski
b5ddd99adf Updated hunter package links 2017-11-15 08:48:11 +01:00
Niels Lohmann
4c4f60f438 📝 fixes #820 2017-11-06 20:35:05 +01:00
Niels Lohmann
1af5601a2a Merge pull request #811 from Itja/patch-1
Typos README
2017-10-31 18:23:42 +01:00
Itja
e423aea64a Typos README
Hey, thanks for this great library which I've used in many occasions now. I know it's not much, but I wanted to contribute at least a tiny bit back to you by this PR :-) Keep up the good work!
2017-10-31 16:31:14 +01:00
Niels Lohmann
5696660eba 🔨 another try to fix #714
adding std::ios_base::binary when opening all_unicode.json.cbor
2017-10-31 15:04:14 +01:00
Niels Lohmann
c4d6626745 🚀 installed Request Info Bot 2017-10-30 16:04:34 +01:00
Niels Lohmann
6d2981db82 📝 overworked templates 2017-10-29 16:32:23 +01:00
Niels Lohmann
87df1d6708 Merge branch 'develop' of https://github.com/nlohmann/json into develop 2017-10-29 11:55:04 +01:00
Niels Lohmann
fa1425b87c 🚀 installed Sentiment Bot 2017-10-29 11:54:53 +01:00
Niels Lohmann
73d0095154 Merge pull request #807 from theodelrieu/fix/805
add forwarding references to json_ref constructor
2017-10-28 15:33:22 +02:00
Théo DELRIEU
4b46abf97c add forwarding references to json_ref constructor
fixes #805
2017-10-28 14:22:57 +02:00
Niels Lohmann
8e067c0c3c 🔨 set bidirectional iterator tag #593 2017-10-28 09:41:35 +02:00
Niels Lohmann
cea3f24ff9 📝 comment to address #561 2017-10-27 16:39:52 +02:00
Niels Lohmann
61cc07ff38 📝 some documentation 2017-10-27 16:07:04 +02:00
Niels Lohmann
734e2b73cf 🔨 cleanup 2017-10-27 11:49:24 +02:00
Niels Lohmann
7820b5eccb 📝 thanks for #795 2017-10-27 11:49:17 +02:00
Niels Lohmann
77f8e2f987 Merge pull request #795 from jseward/develop
Add transparent comparator and perfect forwarding support to find() and count()
2017-10-27 11:47:23 +02:00
Niels Lohmann
c215b77936 🚀 installed Stale Bot 2017-10-25 11:37:33 +02:00
Jamie Seward
992c836b30 Add missing spaces 2017-10-24 00:14:25 -07:00
Jamie Seward
715c98b404 Remove extra spaces 2017-10-24 00:06:22 -07:00
Jamie Seward
6c9a401ebc Remove old non-perfect forwarding find and count 2017-10-24 00:01:56 -07:00
Jamie Seward
16ffdbcb20 Remove c++17 support flag in cmake
Already covered by AppVeyor
2017-10-23 23:50:06 -07:00
Jamie Seward
73b1629a15 Remove tabs for spaces 2017-10-23 23:45:39 -07:00
Niels Lohmann
1b1bd0e3e6 #714 is still not fixed 2017-10-23 12:01:50 +02:00
Jamie Seward
33c6511dd0 Remove JSON_HAS_STRING_VIEW
Instead implement @gregmarr's PR comments that perfect forwarding should be used. Also cleaned up cpp language standard detection.
2017-10-23 00:43:26 -07:00
Niels Lohmann
89650c99dd 🚧 checking if #714 is now fixed with MSVC
Hopefully, #764 fixed this.
2017-10-22 11:16:33 +02:00
Niels Lohmann
b0c380b0f8 📝 cleanup after the last PRs 2017-10-22 09:12:35 +02:00
Niels Lohmann
be4fba7baf Merge branch 'develop' of https://github.com/nlohmann/json into develop 2017-10-22 08:53:46 +02:00
Niels Lohmann
f193427e91 🔨 some simplifications 2017-10-22 08:53:43 +02:00
Niels Lohmann
24b6e028a9 improved test coverage 2017-10-22 08:53:27 +02:00
Niels Lohmann
3094640446 Merge pull request #764 from pjkundert/develop-simplify-istream
Simplified istream handing #367
2017-10-22 08:52:28 +02:00
Niels Lohmann
ef40673acb Merge branch 'develop' into develop-simplify-istream 2017-10-22 08:52:15 +02:00
Jamie Seward
d468f8c4e6 Use consistent logic to determine if string_view exists 2017-10-21 16:36:05 -07:00
Jamie Seward
59cde1ad6e Fix for _HAS_CXX17 == 0
Copied from solution to https://github.com/nlohmann/json/issues/464
2017-10-21 16:29:37 -07:00
Jamie Seward
1a66679929 Add string_view support
This avoids unnecessary string copies on often used
find().
2017-10-21 15:20:13 -07:00
Niels Lohmann
33df3250c3 Merge pull request #793 from sonulohani/develop
Error : 'identifier "size_t" is undefined' in linux
2017-10-21 10:58:27 +02:00
Sonu Lohani
92da334862 Error : 'identifier "size_t" is undefined' in linux 2017-10-21 12:52:44 +05:30
Niels Lohmann
2e281ba64b Merge pull request #788 from jseward/develop
Fix Visual Studio 2017 warnings
2017-10-18 15:04:24 +02:00
Jamie Seward
a99fcb4e7d Add comments and newline 2017-10-17 22:53:35 -07:00
Jamie Seward
917d9d8bc3 Fix Visual Studio 2017 warnings 2017-10-16 23:23:55 -07:00
Niels Lohmann
7c8f0a4186 Merge pull request #785 from jseward/develop
Fix warning C4706 on Visual Studio 2017 - fixes #784
2017-10-16 19:48:17 +02:00
Niels Lohmann
b27a142ec0 Merge pull request #783 from eld00d/patch-1
Set GENERATE_TAGFILE in Doxyfile
2017-10-16 17:54:28 +02:00
Perry Kundert
a8cc7a1bc8 Consistently use std::char_traits int_type-->char conversion intrinsics 2017-10-16 08:06:10 -07:00
Jamie Seward
af99090742 Disable warning C4389: '==': signed/unsigned mismatch
Lots of tests have this warning.

Also moved out of for loop, doesn't need to be done every loop.
2017-10-16 01:02:48 -07:00
Jamie Seward
8ba7f69ab4 Fix whitespace 2017-10-16 00:49:59 -07:00
Jamie Seward
8a4af820c7 Fix warning C4706 2017-10-16 00:41:58 -07:00
Jamie Seward
19f8f1c075 Add missing "u8"
This causes test-udt to crash due to bad iterator
2017-10-16 00:21:38 -07:00
Jamie Seward
5ec44fe9e3 Add /W4 for MSVS 2017-10-15 22:56:38 -07:00
Nate Vargas
727ee7d03e Set GENERATE_TAGFILE in Doxyfile
Allows documentation to be linked from other projects to https://nlohmann.github.io/json using Doxygen with the tag:
TAGFILES = $(SOME_PATH)/nlohmann_json.tag=https://nlohmann.github.io/json
2017-10-14 19:06:38 -05:00
Niels Lohmann
d300a8e268 🚨 fixed warnings #776 2017-10-13 08:46:29 +02:00
Perry Kundert
0b803d0a5f Simplify the json/src/benchmarks.cpp to allow more optimal code gen.
o For some unknown reason, the complexity of the benchmark platform
  prevented some C++ compilers from generating optimal code, properly
  reflective of the real performance in actual deployment.
o Added the json_benchmarks_simple target, which performs the same
  suite of tests as json_benchmarks.
o Simplified the benchmark platform, and emit an "Average" TPS
  (Transactions Per Second) value reflective of aggregate parse/output
  performance.
2017-10-07 15:50:19 -07:00
Perry Kundert
23440eb86e Remove outdated commentary about the value of eof(), retain input type
o We assume the same character int_type as the unerlying std::istream
o There are no assumptions on the value of eof(), other than that it
  will not be a valid unsigned char value.
o To retain performance, we do not allow swapping out the underlying
  std::streambuf during our use of the std::istream for parsing.
2017-10-06 12:54:43 -07:00
Perry Kundert
45e1e3d48a Revert some unnecessary member initializer changes. 2017-10-06 07:53:31 -07:00
Perry Kundert
5e480b56d8 Further simplify character type handling 2017-10-06 07:37:49 -07:00
Perry Kundert
1b43a45bec Implement correct handling of std::streambuf int_type, eof()
o Make no assumptions about eof(), other than that it is somewhere
  outside of the valid range of char_type.
2017-10-05 16:16:41 -07:00
Perry Kundert
184dab60e6 Accelerate access to underlying std::istream streambuf 2017-10-05 16:16:41 -07:00
Perry Kundert
f775922ca8 Specify initializers for yytest, token_string using initializer-lists
o We can retain -Weffc++ and specify default initializers by using
  initializer lists.  The risks are low (of additional non-conformat
  compilers), because there is already one other such initialization
  used in the code-base.
2017-10-05 16:16:41 -07:00
Perry Kundert
546e148b24 Further performance improvements, and corrections in get_token_string
o An (-'ve valued, typically -1) EOF must never be allowed in
  token_string, as it be converted to 255 -- a legitimate value.
o Comparing against a specific eof() (-1, typically) is more costly than
  detecting +'ve/-'ve.  Since EOF is the only non-positive value allowed
  we can use the simpler test.
o Removed unnecessary test for token_string size, as it is already
  tested in the method, and must never occur in correct code; used an
  assert instead.
2017-10-05 16:16:41 -07:00
Perry Kundert
8665e25942 Rename get_string to move_string to imply side-effect 2017-10-05 16:16:41 -07:00
Perry Kundert
e0d890cc23 Corrected unnnecessary const restriction on returned std::string 2017-10-05 16:16:41 -07:00
Perry Kundert
97a388802d Improve performance by constructing yytext as a std::string
o Return its contents when necessary.  In many cases, this avoids
  construction of multiple copies of the yytext token.  Exceeds
  performance of current develop branch.
2017-10-05 16:15:46 -07:00
Perry Kundert
7c523338c5 Remove unnnecessary NUL termination of yytext (as it may contain NULs) 2017-10-05 16:01:41 -07:00
Perry Kundert
14ca1f6f09 Restore istream performance #764
o Use std::streambuf I/O instead of std::istream; does not maintain
  (unused) istream flags.
o Further simplify get/unget handling.
o Restore original handling of NUL in input stream; ignored during
  token_string escaping.
2017-10-05 16:01:41 -07:00
Perry Kundert
12efeadc2e Further simplify istream handling; use native unget 2017-10-05 16:01:41 -07:00
Perry Kundert
f585fe4eec Test to confirm parsing of multiple JSON records in a istream #367 2017-10-05 16:01:41 -07:00
Perry Kundert
90adf6ec20 Simplify get_token_string, unnecessary buffering, handle Byte Order Mark 2017-10-05 16:01:41 -07:00
Niels Lohmann
0c0851dbea 📝 comment how to integrate tsl::ordered_map (#546) 2017-10-05 20:36:18 +02:00
Niels Lohmann
bab4a15748 📝 comment how to integrate fifo_map (#485) 2017-10-05 20:33:27 +02:00
Niels Lohmann
60439aff05 📝 different cmake call 2017-10-05 19:43:59 +02:00
Niels Lohmann
73d1b55aba 🔧 executing tests in parallel 2017-10-05 19:43:39 +02:00
Niels Lohmann
615366447a 🔧 removing -Weffc++ warnings 2017-10-05 19:43:19 +02:00
Niels Lohmann
73727c989c Merge branch 'feature/coveralls' into develop 2017-10-05 19:08:28 +02:00
Niels Lohmann
75f4678b96 🔨 added filter script for branch coverage 2017-10-05 19:08:15 +02:00
Niels Lohmann
c204ac82e0 🔨 adjusted Coverity script to work without Makefile 2017-10-05 07:13:59 +02:00
Niels Lohmann
7b82e4b4c8 🔨 added Makefile target to calculate lcov coverage 2017-10-05 00:17:09 +02:00
Niels Lohmann
1b3df3a63f 🔨 trying to use Coveralls with CMake #698 2017-10-04 22:18:21 +02:00
Niels Lohmann
99ee4c1eaf 🔨 cleaned up Makefiles and docs #698 2017-10-04 19:27:35 +02:00
Niels Lohmann
5cb6d7187d 🚨 fixing last warning in #755 2017-10-04 17:28:35 +02:00
Niels Lohmann
4e81c1db47 Merge pull request #765 from nlohmann/feature/issue698
using more CMake
2017-10-04 10:39:56 +02:00
Niels Lohmann
e2045eae53 🏁 and another try 2017-10-03 18:47:08 +02:00
Niels Lohmann
a85bc358f7 🏁 another try 2017-10-03 18:21:40 +02:00
Niels Lohmann
3457e7bc5b 🏁 try to get MSVC 2017 running again 2017-10-03 17:57:40 +02:00
Niels Lohmann
54bd1b5124 Merge branch 'develop' into feature/issue698 2017-10-03 17:23:05 +02:00
Niels Lohmann
7435d54e97 🔨 clean up 2017-10-02 23:06:41 +02:00
Niels Lohmann
4912231450 Merge branch 'develop' into feature/issue698 2017-10-02 18:25:25 +02:00
Niels Lohmann
b91805e1f0 🚨 removing a compiler warning #755 2017-10-02 18:11:36 +02:00
Niels Lohmann
f89f8b2d0b Merge branch 'develop' into feature/issue698 2017-10-02 17:47:53 +02:00
Niels Lohmann
8be303d4fb 🏁 fixing a min() call for MSVC #762 2017-10-02 13:54:14 +02:00
Niels Lohmann
1df836ce40 removed call to std::signbit #761 2017-10-01 15:48:29 +02:00
Niels Lohmann
8af49d4be5 🚨 removing compiler warnings #755 2017-09-30 11:00:26 +02:00
Niels Lohmann
1a66527dca 📝 fixed documentation #745 2017-09-30 10:18:18 +02:00
Niels Lohmann
b05ea3de55 Merge pull request #753 from gregmarr/patch-1
Add info for the vcpkg package.
2017-09-26 22:36:36 +02:00
gregmarr
ec60ff3451 Add info for the vcpkg package. 2017-09-26 08:39:38 -07:00
Niels Lohmann
647711fad1 improved test coverage 2017-09-14 17:31:28 +02:00
Niels Lohmann
737816d0cd 👷 another try with Travis 2017-09-14 17:31:14 +02:00
Niels Lohmann
e75adc21a5 Merge branch 'develop' into feature/issue698 2017-09-13 18:57:25 +02:00
Niels Lohmann
b90529c36d improved test coverage 2017-09-13 18:56:54 +02:00
Niels Lohmann
82c93680d1 Merge branch 'develop' into feature/issue698 2017-09-10 22:38:23 +02:00
Niels Lohmann
e2e0ecd867 improved test coverage 2017-09-10 22:38:04 +02:00
Niels Lohmann
248db1e423 Merge branch 'develop' into feature/issue698 2017-09-10 11:42:57 +02:00
Niels Lohmann
7410763731 improved test coverage 2017-09-10 11:42:43 +02:00
Niels Lohmann
cafc2d057a Merge branch 'develop' into feature/issue698 2017-09-10 10:22:10 +02:00
Niels Lohmann
da97cf7895 improved test coverage 2017-09-10 10:21:53 +02:00
Niels Lohmann
295d65ada7 Merge branch 'develop' into feature/issue698 2017-09-10 01:13:43 +02:00
Niels Lohmann
fcba9ec537 🔨 clean up 2017-09-10 01:12:03 +02:00
Niels Lohmann
41994ba028 Merge branch 'develop' into feature/issue698 2017-09-09 16:53:37 +02:00
Niels Lohmann
b21d7810fa improved test coverage 2017-09-09 16:53:27 +02:00
Niels Lohmann
c1d6478584 Merge branch 'develop' into feature/issue698 2017-09-09 13:07:40 +02:00
Niels Lohmann
9ae6796a38 improved test coverage 2017-09-09 13:07:10 +02:00
Niels Lohmann
31ce7e1e59 Merge branch 'develop' into feature/issue698 2017-09-09 11:05:20 +02:00
Niels Lohmann
fd250ae2b1 improved test coverage 2017-09-09 11:04:58 +02:00
Niels Lohmann
5c08b84dec back to previous MSVC 2017 2017-09-06 18:26:52 +02:00
Niels Lohmann
da14286abb 👷 try to use MSVC 2017 again 2017-09-06 18:13:35 +02:00
Niels Lohmann
c607b5c2ac 📝 improved documentation 2017-09-06 17:14:06 +02:00
Niels Lohmann
91e0032853 📝 improved documentation 2017-08-29 23:46:26 +02:00
Niels Lohmann
b41b13047c 👷 removed unneccessary test 2017-08-27 11:30:36 +02:00
Niels Lohmann
15e757c42b 🔨 trying to fix memory issue with valarray 2017-08-27 10:41:39 +02:00
Niels Lohmann
0e94ba8857 👷 using the same compilers 2017-08-26 08:56:34 +02:00
Niels Lohmann
4f5c345817 👷 run sanitizer another time to check if it works 2017-08-26 08:20:37 +02:00
Niels Lohmann
8608f42187 👷 trying to use libstdc++
https://github.com/travis-ci/apt-source-whitelist/issues/372#issuecomment-320547215
2017-08-25 22:49:18 +02:00
Niels Lohmann
5e7acbf05e 👷 adjusted flags for Clang sanitizer
we are overrding the CXXFLAGS provided by travis in order to use gcc's libstdc++
2017-08-25 22:34:00 +02:00
Niels Lohmann
268f5a3d0a 👷 added option to switch off exceptions 2017-08-25 21:29:27 +02:00
Niels Lohmann
839681ff9f 👷 using Ninja 2017-08-25 21:01:07 +02:00
Niels Lohmann
3dcd360139 👷 adding status messages 2017-08-25 20:19:58 +02:00
Niels Lohmann
05b97c473a 👷 added flags for Valgrind and Clang sanitizer 2017-08-25 20:12:21 +02:00
Niels Lohmann
c87b080cc5 👷 new cmake file for test cases 2017-08-25 18:06:22 +02:00
Niels Lohmann
5b71bf09a1 Merge pull request #708 from theodelrieu/fix/from_json_tuple_pair
fix from_json implementation for pair/tuple
2017-08-24 12:40:16 +02:00
Théo DELRIEU
bb1b4c934e fix from_json implementation for pair/tuple
Introduced by 6e4910d5c5

Fixes #707
2017-08-23 10:05:43 +02:00
Niels Lohmann
e45eaf6e30 Revert "👷 using libc++ with Clang"
This reverts commit 41b2c69bdb.
2017-08-23 08:39:19 +02:00
Niels Lohmann
0b5e8f859b 🔨 cleanup
Fixed some warning in Clion.
2017-08-23 00:42:15 +02:00
Niels Lohmann
9fd031b6f4 🐛 re-added support for std::valarray #702 2017-08-22 23:28:23 +02:00
Niels Lohmann
41b2c69bdb 👷 using libc++ with Clang 2017-08-22 22:04:38 +02:00
Niels Lohmann
cd53790993 👷 using Clang 5.0 2017-08-21 20:03:24 +02:00
Niels Lohmann
e569b9736b 👷 trying to fix build error
See http://help.appveyor.com/discussions/problems/7450-build-error-on-vs-2017-image-suddenly.
2017-08-21 17:31:14 +02:00
Niels Lohmann
ba5d37ba4b 👷 added Clang 5.0 (see https://docs.travis-ci.com/user/languages/cpp/#clang) 2017-08-21 17:27:35 +02:00
Niels Lohmann
64ef100ebf Revert "💥 changed iterators to andom_access_iterator #593"
This reverts commit c77a0be5f3.
2017-08-20 20:44:44 +02:00
Niels Lohmann
8acaf5bdbc 🚨 fixing two compiler warnings 2017-08-20 19:31:07 +02:00
Niels Lohmann
c77a0be5f3 💥 changed iterators to andom_access_iterator #593
This commit changes the iterator category to andom_access_iterator and allows offsets and subscript operators for object iterators.
2017-08-16 21:35:22 +02:00
Niels Lohmann
aba8b58492 🔨 approach to un-break the changes for #462 2017-08-16 20:11:05 +02:00
Niels Lohmann
22b59693f1 💥 CBOR/MessagePack input must end with EOF #505
The CBOR and MessagePack parsers now expect the input to be read until the end. Unless the new parameter "strict" is set to false (it is true by default), an exception is raised if the parser ends prematurely. This is a breaking change as the parsers ignored unread input so far.

Furthermore, the offset/startIndex paramter introduced in #462 was removed as this behavior can be mimicked with an iterator range. For instance, instead of calling "from_cbor(vec, 5);", you can write "from_cbor({vec.begin()+5, vec.end()});".
2017-08-16 14:48:23 +02:00
Niels Lohmann
1f31a5b808 ⬆️ Catch v1.9.7 2017-08-16 10:23:39 +02:00
Niels Lohmann
f5a53de845 👷 running sanitizer job in parallel 2017-08-16 09:21:20 +02:00
Niels Lohmann
21726d8d8f 👷 run sanitizer after tests 2017-08-16 08:11:02 +02:00
Niels Lohmann
df572aca79 👷 set sanitizer to clang4 2017-08-16 07:42:57 +02:00
Niels Lohmann
4391bf5615 Merge branch 'feature/update' into develop 2017-08-16 07:39:30 +02:00
Niels Lohmann
1e360bb32b 🔨 preparation for #505
Added a parameter to control whether parsing CBOR and MessagePack must completely consume the input.
2017-08-16 07:39:11 +02:00
Niels Lohmann
002410410f Merge branch 'develop' into feature/update 2017-08-15 21:42:58 +02:00
Niels Lohmann
72afe53fa0 📝 updated documentation for update() function #661 2017-08-15 21:42:50 +02:00
Niels Lohmann
76123fab76 📝 added note wrt. #667 2017-08-15 20:49:18 +02:00
Niels Lohmann
fdff42bc3d 👷 forgot to install Cmake on OSX 2017-08-15 20:30:01 +02:00
Niels Lohmann
039e2f03bc Merge branch 'develop' into feature/update 2017-08-15 19:54:22 +02:00
Niels Lohmann
7f4722a75d Merge branch 'feature/travis_clang' into develop 2017-08-15 19:52:47 +02:00
Niels Lohmann
08805f7f14 🔨 cleanup 2017-08-13 20:57:27 +02:00
Niels Lohmann
988077e046 Merge branch 'develop' into feature/travis_clang 2017-08-13 20:27:27 +02:00
Niels Lohmann
7d19aed567 🔨 cleanup 2017-08-13 19:02:58 +02:00
Niels Lohmann
569c00eb18 👷 changed c++17 to c++1z 2017-08-10 23:41:12 +02:00
Niels Lohmann
6151b056eb 🔨 cleanup 2017-08-10 23:40:30 +02:00
Niels Lohmann
bade3b3e6c 👷 cleanup 2017-08-10 21:17:40 +02:00
Niels Lohmann
76b195d7d1 👷 fix for coverity + clang-5.0 2017-08-10 20:54:59 +02:00
Niels Lohmann
cd34358e7c 👷 removing clang from source 2017-08-10 20:37:23 +02:00
Niels Lohmann
5eb9f5fd4f 👷 clang-3.4 2017-08-10 20:31:59 +02:00
Niels Lohmann
f49356e703 👷 clang-3.4 2017-08-10 20:26:49 +02:00
Niels Lohmann
e0f8eb1710 👷 clang-4.0 2017-08-10 20:21:41 +02:00
Niels Lohmann
6dc89e47fc 👷 clang-3.9 2017-08-10 20:16:35 +02:00
Niels Lohmann
8de710bbe7 👷 added source for gcc 2017-08-10 20:12:27 +02:00
Niels Lohmann
195d773bc5 👷 added gcc 2017-08-10 20:09:39 +02:00
Niels Lohmann
e7f2d2646a 👷 removed gcc 2017-08-10 20:06:47 +02:00
Niels Lohmann
6b20f6d1ef 👷 clang-3.8 2017-08-10 20:04:36 +02:00
Niels Lohmann
82cd8c8d02 👷 another try 2017-08-10 19:59:00 +02:00
Niels Lohmann
f256587c4f 👷 clang-3.4 2017-08-10 19:56:09 +02:00
Niels Lohmann
c06b5c5c10 👷 clang-3.5 2017-08-10 19:50:36 +02:00
Niels Lohmann
3283352db3 👷 using clang++ 2017-08-10 19:45:33 +02:00
Niels Lohmann
c20dd7522f 👷 another try 2017-08-10 19:40:09 +02:00
Niels Lohmann
94dfecd487 👷 removed g++ 2017-08-10 19:31:43 +02:00
Niels Lohmann
8963aae57d 👷 clang-3.6 2017-08-10 19:24:36 +02:00
Niels Lohmann
5aceb0e029 👷 clang-3.6 2017-08-10 19:23:55 +02:00
Niels Lohmann
e7a7e4f81f 👷 fixed compiler 2017-08-10 19:18:45 +02:00
Niels Lohmann
e333562633 👷 different source 2017-08-10 19:15:16 +02:00
Niels Lohmann
eb6de822bb 👷 clang-3.7 2017-08-10 19:12:04 +02:00
Niels Lohmann
c1642affaa 👷 clang-3.8 2017-08-10 19:03:35 +02:00
Niels Lohmann
a46afd4008 Merge pull request #679 from traits/patch-1
Digraph warning
2017-08-10 11:39:13 +02:00
traits
54c67dcfec Update json.hpp 2017-08-10 09:05:00 +02:00
Niels Lohmann
99ea12f304 📝 acknowledgements for #674, #678, #682, #685, and #686 2017-08-10 06:50:34 +02:00
Niels Lohmann
d26b3f1fe5 Merge pull request #686 from WebProdPP/patch-1
Update json.hpp
2017-08-10 06:44:59 +02:00
Niels Lohmann
345846b514 Merge pull request #685 from daixtrose/patch-1
Remove duplicate word
2017-08-09 15:32:33 +02:00
WebProdPP
c9509ccf97 Update json.hpp
mistake
2017-08-09 16:13:43 +03:00
Markus Werle
86b3d06a93 remove duplicate word
s/to to/to/
2017-08-09 11:56:48 +02:00
Niels Lohmann
6e5b895f87 Merge pull request #682 from kbthomp1/fix-intel-osx
To fix compilation issue for intel OSX compiler
2017-08-09 10:16:03 +02:00
Kyle Thompson
4b55f0ebd6 To fix compilation issue for intel OSX compiler
o To prevent the compilation issue on OSX with the intel compiler suite.  The
error was found with icpc version 15.0.3.187 where the "__clang_version__" was
not defined correctly, while "__clang__" was.
2017-08-08 18:43:03 -04:00
Niels Lohmann
c90bf5e0f1 👷 removed failing builders 2017-08-08 21:26:15 +02:00
Niels Lohmann
dd008545d1 Merge branch 'develop' of https://github.com/nlohmann/json into develop 2017-08-08 19:15:49 +02:00
Niels Lohmann
054b0250be 👷 trying to install g++ to make clang work 2017-08-08 19:14:22 +02:00
traits
ab44a50d98 Digraph warning
The original version can trigger a digraph-related warning in VS2015. Is this namespace construct a typo or something deliberate?
2017-08-07 14:23:48 +02:00
Niels Lohmann
b32a6b8c75 Merge pull request #678 from DmitryKuk/develop
massage -> message
2017-08-05 13:42:43 +02:00
DmitryKuk
19437c15de massage -> message 2017-08-05 10:43:08 +03:00
Niels Lohmann
e523312fa2 improved test coverage 2017-08-03 17:47:42 +02:00
Niels Lohmann
d2c3592908 added test cases for update #661 2017-08-02 22:44:58 +02:00
Niels Lohmann
d1e13d5128 🎉 first draft for #661 2017-08-02 22:12:41 +02:00
Niels Lohmann
0ea0d7d860 Merge pull request #674 from wincent/patch-1
Fix "not constraint" grammar in docs
2017-08-01 20:21:04 +02:00
Niels Lohmann
efdfd3aa5b replaced by-value call #673 2017-08-01 19:37:25 +02:00
Greg Hurrell
391303521a Fix "not constraint" grammar in docs 2017-08-01 08:56:28 -07:00
Niels Lohmann
76ecb2bd60 Merge pull request #671 from dan-42/develop
Add documentation for integration with CMake and hunter
2017-08-01 07:15:55 +02:00
dan-42
db0b9732d4 DOC: add sort mentioning about support in hunter 2017-07-31 23:20:37 +02:00
Niels Lohmann
e60002a1b3 🔨 fixed GCC warnings in #663
https://github.com/nlohmann/json/pull/663#issuecomment-318931884
2017-07-31 23:17:14 +02:00
dan-42
966989a3f5 CONFIG: pin cmake to enable only C++ 2017-07-31 09:49:26 +02:00
Niels Lohmann
850d856aae 🔨 cleanup after #663 2017-07-30 20:30:05 +02:00
Niels Lohmann
3d67ec40a6 Merge branch 'develop' of https://github.com/nlohmann/json into develop 2017-07-30 20:01:35 +02:00
Niels Lohmann
85c768084b 🔨 using emplace 2017-07-30 20:01:31 +02:00
Niels Lohmann
67fb517ccd Merge pull request #669 from dan-42/change_installed_cmake_include_path
REFACTOR: rewrite CMakeLists.txt for better inlcude and reuse
2017-07-30 20:01:03 +02:00
Niels Lohmann
80e95844f6 Merge pull request #663 from himikof/move-construction
Support moving from rvalues in std::initializer_list
2017-07-30 20:00:46 +02:00
Niels Lohmann
aad55219f8 Merge branch 'develop' into move-construction 2017-07-30 19:49:24 +02:00
Niels Lohmann
96dd4ffa19 🔨 simplified a call 2017-07-30 18:30:34 +02:00
Niels Lohmann
7737a29518 🔨 small parser performance improvements
- replaced list of pairs by flat list in next_byte_in_range
- implemented early exit in case of parse errors
- reused memory for object keys
- direct calls to embedded objects/arrays for insertions
2017-07-30 13:25:36 +02:00
dan-42
f434942371 REFACTOR: rewrite CMakeLists.txt for better inlcude and reuse
The rewrite uses more cmake build-in automatisms and build-in generates
variables to allow better generic reuse.
* cmake  files are installed to
``` <install_prefix>/lib/cmake/nlohmann_json/ ``` for best support on
most systems
* include path is set to ``` include ```  for usage as ``` #include
<nlohmann/json.hpp> ```
2017-07-29 11:59:09 +02:00
Niels Lohmann
c819a2d732 🔨 refactored some scanner internals 2017-07-28 19:18:50 +02:00
Niels Lohmann
5851daa576 binary formats can be stored in std::string, std::ofstreams or std::ostringstream #477 2017-07-28 00:21:55 +02:00
Niels Lohmann
c136b6f200 Merge pull request #666 from effolkronium/develop
enable_testing only if the JSON_BuildTests is ON
2017-07-27 20:48:56 +02:00
Niels Lohmann
7d51214045 implemented exception-free parser #458 #582
You can now pass a boolean "allow_exceptions" to the parse functions. If it is false, no exceptions are thrown in case of a parse error. Instead, parsing is stopped at the first error and a JSON value of type "discarded" (check with is_discarded()) is returned.
2017-07-27 20:33:11 +02:00
Ilya Polishchuk
a27dd3a6f6 enable_testing only if JSON_BuildTests is ON 2017-07-27 17:50:24 +03:00
Niels Lohmann
669ebf51bc 🔨 fixed an error in MSVC 2017-07-27 06:04:35 +02:00
Niels Lohmann
3d589fd032 🔨 fixed compilation error 2017-07-26 23:59:56 +02:00
Niels Lohmann
e6aa700360 🔨 cleanup 2017-07-26 23:44:55 +02:00
Nikita Ofitserov
93bb71232d Move from rvalues eagerly to work around MSVC problem
On MSVC compiler, temporaries that are constructed during a
list initialization, are sometimes destroyed even before calling
the initializing constructor, instead of at the end of the
containing full-expression. This is clearly non-conforming to
[class.temporary].
As the impact of this bug is silently producing incorrect
JSON values, move eagerly from rvalues to be safe.

See https://stackoverflow.com/questions/24586411
2017-07-25 12:17:32 +03:00
Nikita Ofitserov
897879bccb Make detail::json_ref do less work by deferring moves/copies 2017-07-24 12:29:06 +03:00
Nikita Ofitserov
0f4978e503 Fix an actually invalid test
C++ overload resolution/list initialization rules are hard.
2017-07-24 01:08:33 +03:00
Niels Lohmann
4414f94cd5 🔨 using input/output adapters for CBOR and MessagePack
- You can now pass a reference to a vector to the to_cbor and to_msgpack functions. The output will be written (appended) to the vector. #476

- You can now pass an output stream with uint8_t character type to the to_cbor and to_msgpack functions. #477

- You can now read from uint8_t */size in the to_cbor and to_msgpack functions. An input adapter will be created from this pair, so you need to use braces. #478
2017-07-23 23:02:24 +02:00
Nikita Ofitserov
f5cae64e52 Update tests while fixing possible UB
std::initializer_list does not own the temporaries created in
its initialization. Therefore, storing it in an independent
stack variable is unsafe.
2017-07-23 23:59:34 +03:00
Nikita Ofitserov
09cda57309 Support moving from rvalues in an std::initializer_list
This commit works around an issue in std::initializer_list design.
By using a detail::json_ref proxy with a mutable value inside,
rvalue-ness of an input to list initializer is remembered and
used later to move from the proxy instead of copying.
2017-07-23 23:57:17 +03:00
Nikita Ofitserov
cf3ca3b78c Optimize json construction from rvalue string_t/array_t/object_t 2017-07-23 23:50:59 +03:00
Nikita Ofitserov
7b3cbfff23 Add some tests for std::move from std::initializer_list 2017-07-23 23:47:15 +03:00
Niels Lohmann
9b1c058810 🔨 reorganized interfaces for parse/accept functions #623
We now rely on implicit conversions to an input_adapter object in the parse/accept functions.
2017-07-23 18:11:34 +02:00
Niels Lohmann
18e0430bfe 🔨 adding destroy function to discard values 2017-07-22 22:57:22 +02:00
Niels Lohmann
5b5f0090a1 🔨 trying to fix the sanitizer error
Travis found an error with Clang 3.8's sanitizers, see https://travis-ci.org/nlohmann/json/jobs/256366699. Unfortunately, I cannot reproduce this error with clang version 6.0.0 (trunk 308825) locally. However, this seems to be an issue, because so far, we did not reset a value after moving from it.
2017-07-22 16:41:42 +02:00
Niels Lohmann
d53ef95067 🔨 fixed some warnings 2017-07-22 15:33:31 +02:00
Niels Lohmann
c7a69ae03e started working on parser with provded result reference #418
Internally, the parser now writes its result into a JSON value provided as a reference. To be usable, the public interfaces need to be extended.
2017-07-22 15:18:38 +02:00
Niels Lohmann
f513c46749 🔨 further cleanup 2017-07-22 13:35:04 +02:00
Niels Lohmann
024fec8a9b 🔨 more cleanup using clang-tidy 2017-07-21 18:26:07 +02:00
Niels Lohmann
a09193e967 🔨 cleanup
- Replaced codepoint calculation by bit operations.
- Fixed several clang-tidy warnings.
2017-07-20 23:01:16 +02:00
Niels Lohmann
21d23982ca 🐛 fix for #656
A complete rewrite of the string escape function. It now provides codepoint-to-\uxxxx escaping. Invalid UTF-8 byte sequences are not escaped, but copied as-is. I haven’t spent much time optimizing the code - but the library now agrees with Python on every single Unicode character’s escaping (see file test/data/json_nlohmann_tests/all_unicode_ascii.json).

Other minor changes: replaced "size_t" by "std::size_t"
2017-07-17 07:53:02 +02:00
Niels Lohmann
8a9133c6b2 Merge pull request #652 from olegendo/develop
Rename BuildTests to JSON_BuildTests
2017-07-15 11:39:27 +02:00
Niels Lohmann
f1fabd1ba2 📄 added code of conduct
added Contributor Covenant Code of Conduct
2017-07-13 19:16:41 +02:00
Niels Lohmann
dad4916f9e Merge pull request #654 from ryanjmulder/develop
add ensure_ascii parameter to dump. #330
2017-07-12 07:58:45 +02:00
Ryan Mulder
486f3a2d16 restore necessary comman in documentation of dump 2017-07-11 14:18:02 -04:00
Ryan Mulder
40461c6c55 update comment on dump to not indicate that ensure_ascii is true by default 2017-07-11 13:59:07 -04:00
Ryan Mulder
71597be294 add ensure_ascii parameter to dump. #330 2017-07-11 13:48:08 -04:00
Oleg Endo
cd800522e4 Rename BuildTests to JSON_BuildTests
This avoids potential conflicts with other libraries when the library is
built from source and included in a bigger cmake build.
2017-07-11 22:57:49 +09:00
Niels Lohmann
7dee868a42 Merge pull request #643 from theodelrieu/refacto/split_basic_json
Refacto/split basic json
2017-07-09 23:12:35 +02:00
Théo DELRIEU
8585d35c92 move serializer outside of basic_json 2017-07-09 21:30:34 +02:00
Théo DELRIEU
acff23efb2 move binary_{reader,writer} outside of basic_json 2017-07-09 21:30:33 +02:00
Théo DELRIEU
bb752fd30c move json_reverse_iterator outside of basic_json 2017-07-09 21:30:33 +02:00
Théo DELRIEU
0ba98b6fe0 move internal_iterator/iter_impl/iteration_proxy outside of basic_json 2017-07-09 21:30:31 +02:00
Théo DELRIEU
00d6e27194 move primitive_iterator outside of basic_json 2017-07-09 21:22:16 +02:00
Théo DELRIEU
8e681d1e57 move lexer/parser outside of basic_json 2017-07-09 21:22:15 +02:00
Théo DELRIEU
15625ca4a7 move input adapters outside of basic_json 2017-07-09 21:21:12 +02:00
Théo DELRIEU
a332142194 move json_pointer outside of basic_json 2017-07-09 21:21:09 +02:00
Théo DELRIEU
fe086d7432 forward declare basic_json, add two macros
Those macros are used to reduce template argument boilerplate
2017-07-09 16:16:42 +02:00
Niels Lohmann
d3496347fc 👷 removing Clang 3.9 and 4.0
These versions are still not working properly: https://travis-ci.org/nlohmann/json/jobs/251675281
2017-07-09 12:19:14 +02:00
Niels Lohmann
504012a3db 📝 cleanup after #650
As <iostream> is not included in json.hpp any more, all code examples need to include <iostream> now.
2017-07-09 11:51:38 +02:00
Niels Lohmann
a0e0579374 Merge pull request #650 from olegendo/develop
Don't include <iostream>, use std::make_shared
2017-07-09 11:12:46 +02:00
Niels Lohmann
1b2fabe802 👷 adding two recent Clang versions
Maybe the simple approach is working now - at least it is in https://github.com/taocpp/PEGTL/blob/master/.travis.yml
2017-07-09 11:10:18 +02:00
Oleg Endo
e3bb156f82 fix typo 2017-07-09 15:20:28 +09:00
Oleg Endo
b753cb6ee7 use std::make_shared 2017-07-09 15:19:08 +09:00
Oleg Endo
f0ca96d462 include <iosfwd> instead of <iostream>
avoid bloat caused by <iostream> and std::cout and friends in apps where
iostream are not used.
2017-07-09 15:04:49 +09:00
Niels Lohmann
f1c543cb7b 👷 added GCC7 2017-07-08 22:59:19 +02:00
Niels Lohmann
7b05e1a687 🔨 improved performance in dump for deeply nested values 2017-07-08 22:59:04 +02:00
Niels Lohmann
f697fec522 📝 fixed documentation
There was an issue in the documentation example before. Unfortunately, I did not recreate the example outputs.
2017-07-08 22:16:45 +02:00
Niels Lohmann
87bccbc335 🔨 removed exception parse_error.111
It makes no sense to have this special exception. Instead of throwing when an input adapter is created, it is better to detect a parse error in later usage when an EOF is "read" unexpectedly.
2017-07-08 21:35:13 +02:00
Niels Lohmann
b38ecb5ca9 🔨 simplified binary write
Also added some comments and improved the documentation.
2017-07-08 20:31:13 +02:00
Niels Lohmann
b3ac36db93 🔨 excluded uncovered lines
These breaks were just added to silence a GCC warning - the GCC is right about warning as it cannot know that the expect function will not return in these two scenarios.
2017-07-08 18:34:08 +02:00
Niels Lohmann
e67df7c385 Merge branch 'feature/undo_171' into develop 2017-07-08 16:34:00 +02:00
Niels Lohmann
552622343e 📝 fixed typos 2017-07-08 16:18:27 +02:00
Niels Lohmann
566f6dcf30 🔥 removing usused functions #645
It seems these functions are not required any more. The code was added in commit 7e32457 to fix issue #171. There are still regression tests for #171, so when this commit passes the CI, the functions may be removed for good.
2017-07-08 13:33:13 +02:00
Niels Lohmann
6f12749ef6 📝 added version string for Xcode 9 2017-07-08 12:55:05 +02:00
Niels Lohmann
ac42333749 ⬆️ Catch v1.9.6 2017-07-08 12:11:45 +02:00
Niels Lohmann
015c88783e 🔨 fixed a pedantic warning 2017-07-08 12:03:12 +02:00
Niels Lohmann
df2feabb72 👷 added Xcode 9 beta
See https://twitter.com/travisci/status/880550780368855040
2017-07-08 11:57:09 +02:00
Niels Lohmann
63ecbfd36b re-added test
I have no idea why this test has been removed in the first place.
2017-07-07 23:38:04 +02:00
Niels Lohmann
07b78c993c 🐛 fixed undefined behavior bug
When an empty vector was passed to the parse function, an empty iterator range was used to construct an input iterator. Unfortunately, we then cannot use the start iterator to derive a pointer from.

Found with Xcode's undefined behavior sanitizer.
2017-07-07 23:37:16 +02:00
Niels Lohmann
8b123107c0 🔨 fixed some pedantic GCC warnings 2017-07-07 22:41:22 +02:00
Niels Lohmann
32065c8045 📝 fix for #639
Removed deprecated documentation of the comparison operator.
2017-07-07 21:16:33 +02:00
Niels Lohmann
e99b783def 🔨 simplifying scanner 2017-06-22 16:40:15 +02:00
Niels Lohmann
3dc5d95422 Merge branch 'develop' of https://github.com/nlohmann/json into develop 2017-06-21 18:55:28 +02:00
Niels Lohmann
b9a8425cc8 📝 cleanup after #629 and #630 2017-06-21 18:55:25 +02:00
Niels Lohmann
5ee651c387 Merge pull request #630 from Chocobo1/doc_neq
fix typo in operator__notequal example
2017-06-21 18:54:18 +02:00
Niels Lohmann
dad6051f37 Merge pull request #629 from Chocobo1/c4819
Fix MSVC warning C4819
2017-06-21 18:54:03 +02:00
Niels Lohmann
4b5433578a added progress output for Unicode tests
Travis aborts tests if they do not produce output for 10 minutes. This commit shall fix this.
2017-06-21 18:50:11 +02:00
Chocobo1
0395f3fdfb fix typo 2017-06-21 21:41:34 +08:00
Chocobo1
66ffac9e8a Fix MSVC warning C4819
Replace unicode whitespaces by ASCII whitespace 0x20
2017-06-21 16:17:10 +08:00
Niels Lohmann
6f3bebff5c 🔨 removed unexpect function 2017-06-21 07:26:50 +02:00
Niels Lohmann
2fd214c14b 🔨 adjusted pedantic flags 2017-06-20 23:05:37 +02:00
Niels Lohmann
e7695306f1 🔨 fixed a warning 2017-06-20 22:58:02 +02:00
Niels Lohmann
84f2e64a7c improved coverage 2017-06-20 22:35:31 +02:00
Niels Lohmann
9add24ff10 🔨 fixed a warning 2017-06-20 22:20:41 +02:00
Niels Lohmann
2f007ca092 improved coverage 2017-06-20 22:03:36 +02:00
Niels Lohmann
a5c27ede32 🔨 fixed a warning 2017-06-20 21:39:36 +02:00
Niels Lohmann
7c2a187258 improved test coverage 2017-06-20 21:09:26 +02:00
Niels Lohmann
e191dd833f 🔨 fixed warning about pointer members 2017-06-20 21:09:05 +02:00
Niels Lohmann
82b95ca664 🔨 simplified error handling in parser 2017-06-20 20:14:18 +02:00
Niels Lohmann
f2cdb3d594 ⬆️ Catch v1.9.5 2017-06-20 20:13:56 +02:00
Niels Lohmann
c2044205ef 📝 updated used compilers 2017-06-20 16:12:14 +02:00
Niels Lohmann
c2db4a118d 👷 update Travis to use Ubuntu Trusty 14.04 images 2017-06-19 21:51:24 +02:00
Niels Lohmann
70b7455a13 🔨 minor change 2017-06-19 21:50:36 +02:00
Niels Lohmann
4e6f548c0b Merge pull request #624 from theodelrieu/feature/pair_tuple_conversions
add pair/tuple conversions
2017-06-19 17:31:10 +02:00
Théo DELRIEU
08d781058c add from_json support for std::array 2017-06-19 12:03:38 +02:00
Théo DELRIEU
6e4910d5c5 add pair/tuple conversions 2017-06-19 10:16:37 +02:00
Niels Lohmann
112a6f4e53 🔨 replaced lexer's error message by const char* 2017-06-18 13:03:14 +02:00
Niels Lohmann
747f7d36d1 Merge branch 'develop' of https://github.com/nlohmann/json into develop 2017-06-18 00:00:36 +02:00
Niels Lohmann
b79a1a2678 📝 update after #626 2017-06-18 00:00:31 +02:00
Niels Lohmann
7b97100ffd Merge pull request #626 from koemeet/bugfix/vs2017-min-macro-fix
[BugFix] Add parentheses around std::min
2017-06-17 23:58:13 +02:00
Steffen Brem
04a1666ef2 Add parentheses around std::min so it bypasses the macro introduced by windows.h. 2017-06-17 22:01:18 +02:00
Niels Lohmann
1fbb82de89 🔨 using std::array to buffer input 2017-06-17 20:47:53 +02:00
Niels Lohmann
889006f006 regression test for #600 2017-06-17 13:37:04 +02:00
Niels Lohmann
e1ca484bc1 📝 added note about Conan #566 2017-06-17 11:20:09 +02:00
Niels Lohmann
b27d2adcbe accept functions to check if input is valid JSON #458 2017-06-16 19:23:55 +02:00
Niels Lohmann
d415293d41 Merge pull request #615 from theodelrieu/develop
remove std::pair support
2017-06-16 18:16:20 +02:00
Théo DELRIEU
c98364834f remove std::pair support 2017-06-13 11:11:29 +02:00
Niels Lohmann
fd4a0ecabc Merge branch 'feature/ifstream' into develop 2017-06-13 08:41:14 +02:00
Niels Lohmann
88dc7c11fa 🔨 fixed a warning 2017-06-12 19:58:44 +02:00
Niels Lohmann
afb959a083 🔨 removed nonportable code 2017-06-12 19:02:08 +02:00
Niels Lohmann
ac793e957f 🔨 trying to fix #367
Code from https://stackoverflow.com/a/44503794/266378 which is hopefully working with MSVC.
2017-06-12 18:58:58 +02:00
Niels Lohmann
5fa5c17bc6 ✏️ cleanup after #595 2017-06-10 18:29:16 +02:00
Niels Lohmann
6caad48e44 Merge pull request #595 from HenryRLee/iterator_arithmetic
Issue #593 Fix the arithmetic operators in the iterator and reverse iterator
2017-06-10 18:26:48 +02:00
HenryLee
e12c2ee6a8 Merge branch 'develop' into iterator_arithmetic 2017-06-09 20:47:42 +10:00
Niels Lohmann
52f934cbbf Merge pull request #609 from theodelrieu/develop
Add pair support, fix CompatibleObject conversions (fixes #600)
2017-06-07 16:38:23 +02:00
Théo DELRIEU
cea39dfaa8 fix #600
Instead of calling CompatibleObjectType iterator-range constructor,
first convert json::value_type to CompatibleObjectType::value_type
2017-06-07 10:24:59 +02:00
HenryLee
6661ec755b Merge branch 'develop' into iterator_arithmetic 2017-06-07 18:01:46 +10:00
HenryLee
0f065edff6 Revert a change in reverse iterator to pass the test cases 2017-06-07 18:01:01 +10:00
Niels Lohmann
92ef19696a ✏️ cleanup after #598 2017-06-06 20:48:11 +02:00
Niels Lohmann
bfdf0d1ce6 Merge pull request #598 from HenryRLee/issue550
#550 Fix iterator related compiling issues for Intel icc
2017-06-06 20:41:42 +02:00
Théo DELRIEU
85de93ba93 add std::pair<CompatibleStringType, T> support 2017-06-06 13:56:16 +02:00
HenryLee
c98169d0d5 Revert "Change iterator category to random access"
This reverts commit c4ab8f827e.
2017-06-05 21:59:17 +10:00
HenryLee
fb91aa81da Merge branch 'develop' into iterator_arithmetic 2017-06-05 20:24:21 +10:00
HenryLee
2ba554e442 Merge branch 'develop' into issue550 2017-06-05 20:24:08 +10:00
Niels Lohmann
1a9d76679a 🐛 fixed the issue with GCC7 #590 2017-06-04 18:40:32 +02:00
Niels Lohmann
d19c5ced4b 🐛 skipping BOM for iterators #602
I totally forgot about byte order marks in this scenario.
2017-06-02 12:38:32 +02:00
Niels Lohmann
c043ba6978 🔥 removed failing test #529 2017-06-01 07:32:39 +02:00
HenryLee
f2e1643039 Add test cases for iterator to const iterator assignment 2017-05-31 00:50:40 +10:00
HenryLee
2d5f0c0549 Redefine the converting assignment in iterator 2017-05-31 00:50:14 +10:00
HenryLee
c09a4cbbd7 Add test cases for iterator to const iterator conversion 2017-05-31 00:31:16 +10:00
HenryLee
0a51fb22ed Fix indentation 2017-05-30 23:37:24 +10:00
HenryLee
881cd3f420 Remove the iter_impl<const basic_json> copy constructor and copy assignment 2017-05-30 20:57:22 +10:00
HenryLee
790e7ca9e9 Add struct keyword in front of internal_iterator 2017-05-30 20:27:05 +10:00
HenryLee
ce39330ff8 Add converting constructors for iterator 2017-05-30 20:23:25 +10:00
HenryLee
c4ab8f827e Change iterator category to random access 2017-05-30 19:44:55 +10:00
HenryLee
daea213b44 Use static cast in the implementation of the operators of reverse iterator 2017-05-29 23:56:21 +10:00
HenryLee
0c2ed00ebe Add missing test cases for n + it arithmetic in iterators 2017-05-29 22:39:27 +10:00
HenryLee
5b245dae06 Comment out the exception message check in operator[] of reverse iterator 2017-05-29 22:19:10 +10:00
HenryLee
e42db27d6d Fix the indentation from the latest commit 2017-05-29 20:02:58 +10:00
HenryLee
3aef1a582e Change the definition of the operator override of reverse iterator to using the result of the base class directly 2017-05-29 19:45:34 +10:00
HenryLee
a3bf0131c4 Fix some more reverse iterator arithmetic test codes 2017-05-29 19:43:45 +10:00
HenryLee
adc73d6d5f Fix the arithmetic mistakes in reverse iterator 2017-05-29 18:52:53 +10:00
HenryLee
ed62129f8e Override n + iterator operator in the iterator 2017-05-27 13:44:14 +10:00
Niels Lohmann
52adf3fd5b 🔨 fixed compilation 2017-05-22 22:59:57 +02:00
Niels Lohmann
9a576fe1d9 added test for #367 2017-05-22 22:49:39 +02:00
Niels Lohmann
c7bd01edf2 🔨 trying something #367 2017-05-22 17:06:46 +02:00
Niels Lohmann
9e507dfad5 tests and fix for #367
operator>> now works as expected.
2017-05-21 16:36:51 +02:00
Niels Lohmann
16b63d3197 🔨 working toward #367 2017-05-20 12:44:13 +02:00
Niels Lohmann
8a35fdd8f5 🔨 overworked accept() function
Fixed to make sure no token is "overlooked".
2017-05-20 12:24:13 +02:00
Niels Lohmann
9ddc69f3a9 🐛 adjusting fix for future versions #586 2017-05-20 10:49:06 +02:00
Niels Lohmann
99cb095e89 🐛 fix for #586
Also added a Travis builder with -std=c++1z
2017-05-20 10:34:49 +02:00
Niels Lohmann
0f4131d138 Merge pull request #583 from zhaohuaxishi/doxygen_error
fix doxygen error of basic_json::get()
2017-05-15 21:09:43 +02:00
Niels Lohmann
0c3ffe12cd reverting first/second experiment #350 2017-05-15 21:07:58 +02:00
郭荣飞
b8dff3bc16 remove the redundant @ref command 2017-05-14 07:59:07 +08:00
Niels Lohmann
723c875604 💬 replaced "backspace" with "backslash" #509 2017-05-13 19:56:38 +02:00
郭荣飞
dfa371c436 fix doxygen error of basic_json::get() 2017-05-13 23:13:04 +08:00
Niels Lohmann
9b764ee5d6 🏁 fix for #581 2017-05-13 12:27:37 +02:00
Niels Lohmann
978255da8c 📝 updated contribution guidelines 2017-05-13 11:57:15 +02:00
Niels Lohmann
8b88e1b266 Merge pull request #579 from Type1J/develop_feature_first_second
Fixing assignement for iterator wrapper second, and adding unit test
2017-05-13 11:37:57 +02:00
Jay Sistar
b78457b792 Making comparison operators const. 2017-05-11 13:22:47 -04:00
Jay Sistar
00d841bfda Adding equal and not equal operators to proxys. 2017-05-11 14:51:06 +00:00
Jay Sistar
d6c78dacd8 Fixing assignement for iterator wrapper second, and adding unit test 2017-05-10 17:53:27 +00:00
Niels Lohmann
5beea35443 Merge pull request #578 from Type1J/develop_feature_first_second
Adding first and second properties to iteration_proxy_internal
2017-05-10 17:25:54 +02:00
Niels Lohmann
15ef9b8a35 Merge pull request #576 from Type1J/develop
Adding support for Meson.
2017-05-10 16:32:14 +02:00
Jay Sistar
6a656ed375 Adding first and second properties to iteration_proxy_internal 2017-05-10 13:20:52 +00:00
Niels Lohmann
2afbd33472 🔨 working on #367
Test cases succeed as expected, but the example in #367 is not fully
realized yet.
2017-05-10 12:06:24 +02:00
Jay Sistar
87744fd594 Missed one. 2017-05-09 02:04:02 +00:00
Jay Sistar
0719287e44 Reducing chatter about Meson. 2017-05-09 02:01:55 +00:00
Jay Sistar
31fe2f5825 Adding support for Meson. 2017-05-08 13:35:00 +00:00
Niels Lohmann
962da00171 implemented an indentation character #520
An optional parameter for dump() allows to set the character to use for
indentation (default: space). In case a JSON value is serialized to an
output stream, its fill character is used (and can be set with
std::setfill).
2017-05-07 19:27:40 +02:00
Niels Lohmann
fba1bcdd0b 🐛 fixing #575
I forgot to consider the offset.
2017-05-07 13:41:48 +02:00
Niels Lohmann
56ac7908f1 Merge branch 'feature/manual_lexer' into develop 2017-05-05 18:27:56 +02:00
Niels Lohmann
dbcb032f22 Merge branch 'develop' into feature/manual_lexer 2017-05-05 16:48:47 +02:00
Niels Lohmann
ecf895f2d1 📝 mentioned value function on main doc page #570 2017-05-05 16:42:22 +02:00
Niels Lohmann
19d2dec8b6 📝 added badge from isitmaintained.com 2017-05-03 22:49:21 +02:00
Niels Lohmann
8b9f51179e started working on #458
a simple acceptor function
2017-04-24 17:46:21 +02:00
Niels Lohmann
cfc2e8391c 🔨 removed too long running tests 2017-04-24 15:07:43 +02:00
Niels Lohmann
6d2c0a7928 added more Unicode test cases 2017-04-23 22:54:21 +02:00
Niels Lohmann
c42273d2a0 📝 fixed documentation #565
The documentation mismatched the actual code.
2017-04-23 21:46:30 +02:00
Niels Lohmann
2df8f12c09 🏁 another fix for MSVC #464
needed for VS2015.3 with /std:c++latest
2017-04-23 20:51:29 +02:00
Niels Lohmann
734297ff45 🔨 cleanup 2017-04-23 20:32:05 +02:00
Niels Lohmann
01e05d89e9 🔨 fixed a compiler warning
Default arguments are forbidden in lambdas.
2017-04-23 18:40:17 +02:00
Niels Lohmann
b686cc6ad9 🔨 removed #ifdefs 2017-04-23 18:34:14 +02:00
Niels Lohmann
5febd04a26 🐛 fixed test suite 2017-04-23 18:22:35 +02:00
Niels Lohmann
4aedae400e added exhaustive UTF-8 tests
Creates all well-formed sequences of bytes up to length 4. Furthermore,
creates ill-formed sequences by removing required trailing bytes or
changing bytes. As the tests can take a lot of time, preprocessor
symbols are introduced.
2017-04-23 15:12:50 +02:00
Niels Lohmann
e24df7eca9 📝 improved documentation 2017-04-23 15:10:40 +02:00
Niels Lohmann
2a21146160 Merge branch 'develop' into feature/manual_lexer 2017-04-22 11:35:58 +02:00
Niels Lohmann
4b316ec528 Merge branch 'feature/insert' into develop 2017-04-22 09:58:37 +02:00
Niels Lohmann
9b32f72584 📝 fixed examples for Wandbox
As I learned in https://github.com/melpon/wandbox/issues/209, this
library is already installed at Wandbox, so we need to adjust the
examples to use `#include "json.hpp"` insteas of `#include <json.hpp>`.
2017-04-21 22:07:07 +02:00
Niels Lohmann
db9bf953f3 🔨 improved diagnostic output 2017-04-15 10:40:10 +02:00
Niels Lohmann
717106eced 🔨 templated output_adapter and used in class serializer 2017-04-14 19:49:05 +02:00
Niels Lohmann
aea47422a2 📝 updated links and output 2017-04-14 18:13:01 +02:00
Niels Lohmann
6b6e554067 🐛 added missing header
std::setw needs the iomanip header (at least with GCC).
2017-04-14 17:37:28 +02:00
Niels Lohmann
951d0920fc 🐛 fixed README example
The example with the size() operator is bad: using operator[] already
changes the size of the object. The fix makes it clearer.
2017-04-14 17:36:45 +02:00
Niels Lohmann
e2f6cf7f46 🔥 removed .test files
These files were never meant to be versioned.
2017-04-14 17:35:31 +02:00
Niels Lohmann
2d2b98a50a Merge branch 'develop' into feature/manual_lexer 2017-04-12 18:07:25 +02:00
Niels Lohmann
d4469233ac Merge branch 'develop' into feature/insert 2017-04-12 18:01:06 +02:00
Niels Lohmann
42b4cdd4d0 👷 Travis is very picky 2017-04-11 22:13:26 +02:00
Niels Lohmann
ef55626296 👷 added Clang 3.9-5.0
Taken from
https://github.com/travis-ci/docs-travis-ci-com/pull/746/files.
2017-04-11 20:37:38 +02:00
Niels Lohmann
5bea6f383a ✏️ fixed a typo 2017-04-11 18:57:53 +02:00
Niels Lohmann
4c161161f0 Merge branch 'feature/vs2017' into develop 2017-04-10 19:51:58 +02:00
Niels Lohmann
d7e57e3b73 🔨 added an output adapter for the binary writer 2017-04-09 22:13:26 +02:00
Niels Lohmann
f3e43d7c6f 🔨 some cleanup 2017-04-09 21:14:51 +02:00
Niels Lohmann
186a9fd44d 🔨 simplified interface for parser, lexer, and binary_reader
These classes are now constructed with an interface adapter. This moves
complexity from various places into the interface adapter class, or to
some factories which now implement the different flavors of input.

Furthermore, input adapters are kept in std::shared_ptr to avoid the
need of manual deletion.
2017-04-09 19:28:15 +02:00
Niels Lohmann
e48114bbd6 🔨 check for value of _HAS_CXX17 2017-04-09 14:02:04 +02:00
Niels Lohmann
628be157a2 🐛 added fix for #464 2017-04-09 13:52:04 +02:00
Niels Lohmann
c40c8ac92e 👷 excluding MSVC 2015 with "/permissive- /std:c++latest /utf-8" 2017-04-09 12:00:30 +02:00
Niels Lohmann
a9f4094580 👷 another try 2017-04-09 11:47:31 +02:00
Niels Lohmann
180d249f6c 👷 another try 2017-04-09 11:38:42 +02:00
Niels Lohmann
d3d87674c8 👷 fixed AppVeyor syntax 2017-04-09 11:00:39 +02:00
Niels Lohmann
9d9c5216d7 👷 additional flags for MSVC #464
To test a fix for issue #464 (not yet implemented), we first need to
have  an MSVC build with “/permissive- /std:c++latest /utf-8”.
2017-04-09 10:59:45 +02:00
Niels Lohmann
6f99d5b2e9 🔨 fixed test case
One test case for CBOR and MessagePack assumed little endianess.
2017-04-08 23:39:17 +02:00
Niels Lohmann
d4e49873b7 👷 experimenting with configurations 2017-04-08 21:56:42 +02:00
Niels Lohmann
97a25de938 proposal for #428
This implementation forwards the iterators to std::map::insert.
2017-04-07 18:29:09 +02:00
Niels Lohmann
d62d48fc48 🔀 merge branch 'develop' into feature/manual_lexer 2017-04-07 17:19:52 +02:00
Niels Lohmann
90273e930c 🐛 fix for #512
We totally forgot to implement the comparison operators other than ==
and != for scalar types. Consequently, comparing a JSON value with a
scalar type led to compile errors.
2017-04-07 15:44:41 +02:00
Niels Lohmann
ff72f38863 🔨 fixed another warning
Do not store eof() in a char buffer…
2017-04-06 19:54:08 +02:00
Niels Lohmann
b992acc2e7 🔨 fixed a compiler warning 2017-04-05 20:39:27 +02:00
Niels Lohmann
08fdfcca9a 🔨 implemented a binary writer 2017-04-04 23:17:43 +02:00
Niels Lohmann
c28bf823bc 🔨 added endianess check 2017-04-04 17:30:43 +02:00
Niels Lohmann
b15fc13dd1 🔨 implemented MessagePack in binary_reader 2017-04-04 16:59:19 +02:00
Niels Lohmann
3a34f2d82c Merge branch 'develop' into feature/manual_lexer 2017-04-04 15:55:40 +02:00
Niels Lohmann
782570d46f 🔨 cleanup 2017-04-03 22:58:46 +02:00
Niels Lohmann
4f6b63e492 Merge pull request #545 from theodelrieu/feature/enum_class_support
add enum class default conversions
2017-04-03 22:13:59 +02:00
Niels Lohmann
ea667db446 🔨 fixed compilation errors
TIL about C++:

executing m[key()]=val(); for a std::map executes

First key() then val() with Clang

First val() then key() with GCC

#wat
2017-04-03 21:53:23 +02:00
Niels Lohmann
89efe627fe 🔨 a lot of restructuring
- removed uncached input stream adapter; it was too slow anyway
- implemented a class binary_read which parses CBOR based on input
adapters
- in the CBOR parser, numbers are created via memcpy to avoid undefined
behavior
2017-04-02 18:46:21 +02:00
Théo DELRIEU
af9b21151c add enum class default conversions 2017-04-02 13:10:15 +02:00
Niels Lohmann
3a5cf9bd0a 🔨 improved code coverage 2017-04-01 08:34:58 +02:00
Niels Lohmann
c32d2e5b3c 🔨 removed unget() function 2017-04-01 00:36:05 +02:00
Niels Lohmann
8d393b5eff Merge branch 'develop' into feature/manual_lexer 2017-03-31 23:58:45 +02:00
Niels Lohmann
3fa0610856 🔨 added minibench to ignore list 2017-03-31 23:57:24 +02:00
Niels Lohmann
50ee0a62f5 🔨 replaced lookup-tables by switches 2017-03-31 23:24:33 +02:00
Niels Lohmann
4c821c9e9c 🔨 moved buffer size to interface 2017-03-31 17:11:51 +02:00
Niels Lohmann
d07596a0ea 📝 mentioned #540 and fixed #538 2017-03-30 17:39:02 +02:00
Niels Lohmann
7881783745 Merge pull request #540 from tinloaf/diagnostics
Properly pop diagnostics
2017-03-30 17:25:29 +02:00
Lukas Barth
0b1b6307a5 Also change the re2c file 2017-03-30 16:14:02 +02:00
Lukas Barth
40aff4182f Pop for every push 2017-03-30 16:10:03 +02:00
Niels Lohmann
60057a4728 🔨 fixed bugs introduced by merging from develop 2017-03-29 07:54:26 +02:00
Niels Lohmann
a690a9f2d2 Merge branch 'develop' into feature/manual_lexer 2017-03-29 00:57:09 +02:00
Niels Lohmann
c2e80a72d7 🔨 deprecated j << istream / j >> ostream functions #367
The implementation is non-standard. Deprecation allows a simpler API in
the future without removing any features.
2017-03-29 00:39:47 +02:00
Niels Lohmann
9578c0f700 Merge branch 'develop' into feature/manual_lexer 2017-03-28 23:47:17 +02:00
Niels Lohmann
b4dbebffcd added regression test for #464 2017-03-28 23:28:54 +02:00
Niels Lohmann
62dfdf3f5d 📝 addressed #514
NaN values never compare equal to themselves or to other NaN values.
2017-03-28 23:24:59 +02:00
Niels Lohmann
5d586b0192 🔨 cleanup 2017-03-28 23:20:45 +02:00
Niels Lohmann
19d119e18c 🔨 fixed a warning in MSVC 2017-03-28 22:10:24 +02:00
Niels Lohmann
6b12e40478 🏁 removed __builtin_expect for MSVC 2017-03-28 21:55:26 +02:00
Niels Lohmann
d025b6aaf7 Merge branch 'develop' into feature/manual_lexer 2017-03-28 21:39:36 +02:00
Niels Lohmann
19cd206d99 📝 documented Xcode 8.3 2017-03-28 21:39:16 +02:00
Niels Lohmann
a0aa6ad2b2 👷 added Xcode 8.3
https://blog.travis-ci.com/2017-03-28-xcode-83-ga-is-here
2017-03-28 20:42:12 +02:00
Niels Lohmann
d37ca2eba8 🔨 fixed test case 2017-03-28 20:29:27 +02:00
Niels Lohmann
50e251f5f6 🔨 adjusted test case to new signature of token_type_name() 2017-03-28 20:17:00 +02:00
Niels Lohmann
6a6fbea62c 🔨 some cleanup 2017-03-28 20:08:08 +02:00
Niels Lohmann
1e495945f1 🔨 fixed buffer overflow 2017-03-28 18:06:43 +02:00
Niels Lohmann
bbb6bd9de5 🔨 fixing last failing test cases 2017-03-28 17:00:03 +02:00
Niels Lohmann
b0c47abd88 🔨 rewrote string parser to cope with UTF-8 2017-03-27 22:58:44 +02:00
Niels Lohmann
f75e195db3 🔨 added code for user-defined number types 2017-03-26 18:45:04 +02:00
Niels Lohmann
3425527970 🔨 added code for locale-independent number parsing 2017-03-26 18:12:58 +02:00
Niels Lohmann
06e2a291b1 🔨 fixed number parsing 2017-03-26 17:26:41 +02:00
Niels Lohmann
3b069b4b4c 🔨 adjusted more expected exceptions 2017-03-26 16:19:07 +02:00
Niels Lohmann
99e0d8b339 🔨 fixed \uxxxx parsing 2017-03-26 15:29:08 +02:00
Niels Lohmann
f47cf152a8 Merge branch 'develop' into feature/manual_lexer 2017-03-26 13:14:14 +02:00
Niels Lohmann
d4d51460ab Merge branch 'feature/noexcept_exceptions' into develop 2017-03-26 12:54:22 +02:00
Niels Lohmann
3336194306 🔨 reverted changes that led to Travis failures 2017-03-26 12:23:10 +02:00
Niels Lohmann
53b501a785 🔨 cleanup 2017-03-25 23:31:03 +01:00
Niels Lohmann
cf7786887c 🔨 fixed check for is_nothrow_copy_constructible
We now only demand our exceptions to be is_nothrow_copy_constructible
if std::runtime_exception is.
2017-03-25 17:35:57 +01:00
Niels Lohmann
c333679a96 🔨 small refactoring
The solution with a std::runtime_error member is more elegant. It
allows to have std::exception as base class again. However, I still
have no idea why GCC thinks the copy constructor may throw...
2017-03-25 17:25:39 +01:00
Niels Lohmann
cc36c65a89 🚑 made exceptions nothrow-copy-constructible #531
To have nothrow-copy-constructible exceptions, we inherit from
std::runtime_error which can cope with arbitrary-length error messages.
Intermediate strings are built with static functions and then passed to
the actual constructor.
2017-03-25 16:22:52 +01:00
Niels Lohmann
a58ed3cd17 💄 cleanup 2017-03-25 14:47:23 +01:00
Niels Lohmann
20bcf1015b 📝 cleanup after #536 2017-03-25 14:19:05 +01:00
Niels Lohmann
dc6e9b6188 Merge branch 'develop' into feature/manual_lexer 2017-03-25 14:12:58 +01:00
Niels Lohmann
0f9585685a Merge pull request #536 from vpetrigo/feature/VS17_appveyor_support
Add Visual Studio 17 image to appveyor build matrix
2017-03-25 14:12:30 +01:00
Vladimir Petrigo
8edb0cd15c Add VS17 image to appveyor matrix 2017-03-25 14:57:58 +03:00
Niels Lohmann
a93ec07c8c Merge branch 'develop' into feature/manual_lexer 2017-03-24 19:53:19 +01:00
Niels Lohmann
3d597dda5d 📝 update after #534 2017-03-24 19:51:11 +01:00
Niels Lohmann
40160f482a 🚧 manual lexer
This commit removed the re2c lexer and replaced it by a manual version.
Its integration is not yet complete: number parsing does not respect
locales or overflows. Furthermore, parsing does not need to end with
EOF. Therefore, a lot of test cases fail. The idea is to push this
branch forward so we can conduct performance comparisons. So far, a
nice side effect are better diagnosis messages in case of parse errors.
2017-03-24 19:49:02 +01:00
Niels Lohmann
bba688f53e Merge pull request #534 from TedLyngmo/utf8_encoding_enhancement
UTF8 encoding enhancement
2017-03-24 19:38:29 +01:00
Ted Lyngmo
cea2426731 UTF8 encoding enhancement 2017-03-24 14:56:48 +01:00
Niels Lohmann
8a872927e8 Merge pull request #530 from berkus/patch-1
Fix typo
2017-03-23 13:57:54 +01:00
Berkus Decker
b14629b0a6 Fix typo 2017-03-23 14:50:41 +02:00
Niels Lohmann
54db53c230 📝 update after #527 and #525 2017-03-22 08:10:31 +01:00
Niels Lohmann
d60851168e 🚨 fixed a compiler warning #527
The result of snprintf is later used in situations where a long may
overflow.
2017-03-22 08:10:02 +01:00
Niels Lohmann
67a06834b0 Merge pull request #526 from krzysztofwos/feature/exception-base-class
Make exception base class visible in basic_json
2017-03-22 07:50:34 +01:00
Krzysztof Woś
b9c3b8d688 Exit with an error if re2c is not available
Instead of overwriting src/json.hpp with an empty file
2017-03-20 16:00:58 +09:00
Krzysztof Woś
86579209c8 Make exception base class visible in basic_json 2017-03-20 16:00:58 +09:00
Niels Lohmann
31a6c0910e 🚑 fix for #519
Added catch branch for out_of_range exception that can occur if input
file contains a number overflow.
2017-03-17 22:18:48 +01:00
Niels Lohmann
f547679de5 🚑 fix for #516 and #518
We should compare the binary serializations rather than the JSON values
themselves. This fix was already done for CBOR and apparently forgotten
for MessagePack.
2017-03-17 22:18:05 +01:00
Niels Lohmann
2d474b5273 Merge pull request #510 from alex-weej/patch-1
🎨 Namespace `uint8_t` from the C++ stdlib
2017-03-17 06:47:11 +01:00
Alexander “weej” Jones
836f1c4189 🎨 Namespace uint8_t from the C++ stdlib 2017-03-16 18:24:41 +00:00
Niels Lohmann
cd43600e6f 💄 cleanup after #508 2017-03-16 19:02:05 +01:00
Niels Lohmann
773b33e016 Merge pull request #508 from theodelrieu/feature/c_array_conversion
add to_json method for C arrays
2017-03-16 19:00:58 +01:00
Niels Lohmann
c5711f3072 🚧 a lot of minor changes
- Removed unused headers.
- Added override where needed.
- Added description for parse_error.113 exception.
- Fixed some conversion warnings.
- Integrated cbor_expect_string function for CBOR maps.
- Added documentation on the supported CBOR/MessagePack features.
- Added test to check all initial bytes for CBOR input.
2017-03-16 18:39:33 +01:00
Niels Lohmann
483a58f625 🚨 added pedantic flags for GCC
With GCC 7, there are even more diagnostic flags.
2017-03-16 18:35:45 +01:00
Théo DELRIEU
dbebf8de47 add to_json method for C arrays
If the array can be converted to basic_json::string_t, the overload
in this commit is not chosen.
2017-03-16 15:20:39 +01:00
Niels Lohmann
100bf3ef2c Merge branch 'feature/getline' into develop 2017-03-14 23:08:19 +01:00
Niels Lohmann
710f8a2686 📝 improved documentation for to-CBOR and to-msgpack functions 2017-03-14 23:08:05 +01:00
Niels Lohmann
1de80e8af4 🔨 added user-defined exception #493
Replaced old std::invalid_argument exception by parse_error.111 to have
unified exceptions in case of input stream errors.
2017-03-14 21:31:36 +01:00
Niels Lohmann
63c2c62f19 🔨 changed call from "not good()" to "fail()" #493
Also merged develop into this feature branch.
2017-03-14 21:24:53 +01:00
Niels Lohmann
95474e420d 🏁 added parentheses around max/min calls #506
When <Windows.h> is included with MSVC, a macro NOMINMAX is defined
that yields compilation errors when max/min calls are encountered. This
can be fixed by un-defining NOMINMAX, or by placing parentheses around
all min/max calls. We chose the latter.
2017-03-14 21:11:20 +01:00
Niels Lohmann
b026591e9e 🚑 added special case to fuzzers to fix #504
Since #329, NaN and inf numbers do not yield an exception, but are
stored internally and are dumped as “null”. This commit adjusts the
fuzz testers to deal with this special case.
2017-03-14 21:05:38 +01:00
Niels Lohmann
bfe4788e32 🚑 fix for #500
Removed a check that already failed in MSVC.
2017-03-14 16:14:05 +01:00
Niels Lohmann
84072fbd6d 💄 fixed indentation 2017-03-14 16:07:28 +01:00
Niels Lohmann
b8b4362ca4 🔥 removed accidentally committed binaries 2017-03-13 19:04:19 +01:00
Niels Lohmann
c5cf32e34d 🔨 added user-defined exception 406 2017-03-12 20:59:33 +01:00
Niels Lohmann
43b8285249 🔀 merge branch 'feature/exceptions_3.0.0' into develop 2017-03-12 20:34:30 +01:00
Niels Lohmann
855cdcf05c 🔀 merge branch 'develop' into feature/exceptions_3.0.0 2017-03-12 20:22:30 +01:00
Niels Lohmann
8feaf8dc94 💥 implemented new handling of NaN and INF #70 #329 #388
- If an overflow occurs during parsing a number from a JSON text, an
exception (std::out_of_range for the moment, to be replaced by a
user-defined exception #244) is thrown so that the overflow is detected
early and roundtripping is guaranteed.
- NaN and INF floating-point values can be stored in a JSON value and
are not replaced by null. That is, the basic_json class behaves like
double in this regard (no exception occurs). However, NaN and INF are
serialized to “null”.
- Adjusted test cases appropriately.
2017-03-12 18:38:05 +01:00
Niels Lohmann
9355f05888 🔨 cleaned up array from_json methods #473
Removed some code that is not needed any more. Thus, streamlining the
array from_json methods.
2017-03-12 17:05:02 +01:00
Niels Lohmann
87eafd8d6a added regression tests for #473
These tests currently pass without any adjustments to the source code.
2017-03-12 15:20:17 +01:00
Niels Lohmann
80dcf22fc3 🔨 added a check function for MsgPack strings #497
To avoid the error described in #497, I added a function
msgpack_expect_string that is executed every time a string is expected
during the parsing of a map. In case the current byte does not belong
to a MsgPack string, an exception is thrown.
2017-03-12 14:39:20 +01:00
Niels Lohmann
28dbe4e651 📝 overworked documentation for the at functions
Added all possible exceptions to the examples of the at functions.
2017-03-12 13:49:39 +01:00
Niels Lohmann
89f6068385 Merge branch 'develop' into feature/exceptions_3.0.0 2017-03-12 11:51:24 +01:00
Niels Lohmann
dfa4e83cd8 Merge branch 'feature/no_exceptions' into develop 2017-03-12 11:49:52 +01:00
Niels Lohmann
e3e941ef2b 👷 fixed a syntax error 2017-03-12 11:19:27 +01:00
Niels Lohmann
01470f388b 👷 fixed no_exceptions test case
This test case relied on logics that have been replaced by CMake with
#461. This change enables compilation and execution of the test suite
without exceptions by adding an after_success task.
2017-03-12 11:04:26 +01:00
Niels Lohmann
4d7c29923e 🚑 fix for #486
Implemented std::less<value_t> to allow using value_t as std::map key
in MSVC.
2017-03-12 10:40:36 +01:00
Niels Lohmann
4b9c2f1287 🔨 added __EXCEPTIONS to the list 2017-03-11 20:16:13 +01:00
Niels Lohmann
4e49829851 🚑 fix for #493
Added a test to check if the input stream is good() before executing
getline on it. Also added two test cases that set the failbit and
badbit before calling file_line_buffer.
2017-03-11 19:26:12 +01:00
Niels Lohmann
122afbf128 🔨 added defined() check 2017-03-11 18:43:21 +01:00
Niels Lohmann
e3e6cbecc7 🏁 added check for _CPPUNWIND
MSVC does not define __cpp_exceptions, but seems to use _CPPUNWIND when
exception support is switched on, see
https://msdn.microsoft.com/en-us/library/b0084kay.aspx.
2017-03-11 17:59:24 +01:00
Niels Lohmann
65dfc97d40 🔨 using __cpp_exceptions to detect exception support #498
I used __EXCEPTIONS to detect whether exceptions are supported.
Apparently, this is a macro that is only used by libstdc++
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64276). It’s much cleaner
to use __cpp_exceptions as it is in the standard since C++98.

Note that compiling the unit-tests with “-fno-exceptions” still does
not work, because Catch uses throw internally. However, the library’s
exceptions can be switched off by defining JSON_NOEXCEPTION.
2017-03-11 17:44:54 +01:00
Niels Lohmann
ff0b18d10c Merge branch 'feature/vector_bool' into develop 2017-03-11 17:22:14 +01:00
Niels Lohmann
c7afb34e57 🎨 cleanup after #496
Ran “make pretty” and added a note to the README file.
2017-03-11 16:01:26 +01:00
Niels Lohmann
754ce0b991 Merge pull request #496 from TedLyngmo/fix_effcplusplus_warnings
Fix -Weffc++ warnings (GNU 6.3.1)
2017-03-11 15:57:10 +01:00
Niels Lohmann
d9e2dd03bf 🔨 fixed interface for to_json function 2017-03-11 15:46:52 +01:00
Niels Lohmann
f4126e4dd8 added overload for std::less<value_t> #486
MSVC needs this overload to compile code containing a std::map that
uses nlohmann::detail::operator as key.
2017-03-11 15:44:14 +01:00
Niels Lohmann
f5f6dac800 added overload for std::vector<bool> #494
Adds a to_json function for std::vector<bool> to allow implicit
conversion from bit vectors to basic_json.
2017-03-11 15:32:44 +01:00
Ted Lyngmo
70bbf19527 Fix -Weffc++ warnings (GNU 6.3.1) 2017-03-11 15:16:26 +01:00
Ted Lyngmo
5b809b9737 Fix -Weffc++ warnings (GNU 6.3.1) 2017-03-11 15:05:21 +01:00
Ted Lyngmo
9cfb777b65 Fix -Weffc++ warnings (GNU 6.3.1) 2017-03-11 13:56:38 +01:00
Niels Lohmann
758c4addc1 🚑 fix for #492
The original test case relied on an invalidated iterator. This error
did not occur before, but only with GCC with -D_GLIBCXX_DEBUG. This
commit fixes the test case. The library is unaffected by this change.
2017-03-09 18:20:26 +01:00
Niels Lohmann
0f6b8aa718 📝 more documentation for the new exceptions 2017-03-08 23:30:38 +01:00
Niels Lohmann
1ab580d6e9 📝 more documentation for the new exceptions 2017-03-08 23:12:13 +01:00
Niels Lohmann
fe71e7df1f 📝 overworked documentation
Replacing references to std exceptions with user-defined exceptions.
Also changed some examples to the new exceptions.
2017-03-08 21:03:19 +01:00
Niels Lohmann
9374eaa013 🔨 added user-defined exception 501 2017-03-08 19:16:53 +01:00
Niels Lohmann
c8a6ce79ea 🚑 fixing fuzzers to work with new exceptions 2017-03-08 18:37:03 +01:00
Niels Lohmann
fc9b528ec9 🔨 changed an exception 2017-03-08 18:07:21 +01:00
Niels Lohmann
8fcd01631f improved test coverage
Tests for parse_error.109 were missing.
2017-03-08 16:39:17 +01:00
Niels Lohmann
625cf7e3f7 🔨 added user-defined exception 112 2017-03-07 20:05:34 +01:00
Niels Lohmann
757d2c6c7a 🔨 replaced at() calls in msgpack/cbor 2017-03-06 23:45:08 +01:00
Niels Lohmann
5407333224 🔨 added user-defined exception 111 2017-03-06 22:37:46 +01:00
Niels Lohmann
21ec0e7806 🔨 added user-defined exception 110 2017-03-06 21:00:13 +01:00
Niels Lohmann
a186106bde 🔨 user-defined exception 302
Also moved all exception classes into the detail namespace and
introduced them via “using” into basic_json.
2017-03-06 19:34:44 +01:00
Niels Lohmann
38c2e20ce8 added user-defined exceptions 404-405 2017-03-05 23:25:22 +01:00
Niels Lohmann
30331fa21f 🔨 added user-defined exception 403 2017-03-05 23:16:17 +01:00
Niels Lohmann
60da36aee2 🔨 added user-defined exceptions 401-402 2017-03-05 22:56:39 +01:00
Niels Lohmann
491c9780a7 🔨 added user-defined exception 311 2017-03-05 22:39:21 +01:00
Niels Lohmann
6751d650be 🔨 added user-defined exception 311 2017-03-05 22:31:08 +01:00
Niels Lohmann
9e560ca40c 🔨 added user-defined exceptions 313-315 2017-03-05 19:58:26 +01:00
Niels Lohmann
144cf6a4c7 🔨 added user-defined exceptions 310 2017-03-05 19:48:11 +01:00
Niels Lohmann
5cca44c161 🔨 added user-defined exceptions 309 2017-03-05 19:42:05 +01:00
Niels Lohmann
70b2c3f45e 🔨 added user-defined exceptions 308 2017-03-05 19:35:24 +01:00
Niels Lohmann
2a9393af00 🔨 added user-defined exceptions 307 2017-03-05 19:26:44 +01:00
Niels Lohmann
bb740c43fb 🔨 added user-defined exceptions 306 2017-03-05 19:15:56 +01:00
Niels Lohmann
aa842b4a27 🔨 added user-defined exceptions 305 2017-03-05 19:08:12 +01:00
Niels Lohmann
f473f74fb0 🔨 added user-defined exceptions 303-304 2017-03-05 18:56:35 +01:00
Niels Lohmann
068c7acda9 🔨 added user-defined exceptions 301 2017-03-05 18:40:09 +01:00
Niels Lohmann
0c40c8e3be 🔨 added user-defined exceptions 2xx 2017-03-03 14:34:57 +01:00
Niels Lohmann
a4274d7766 🔨 added user-defined exceptions 205-206 2017-03-03 14:00:42 +01:00
Niels Lohmann
875b2da95d 🔨 added user-defined exceptions 203-204 2017-03-03 13:38:14 +01:00
Niels Lohmann
9381f6c4da 🔨 added user-defined exceptions 201-202
Started implementing exceptions for invalid iterators.
2017-03-03 13:19:45 +01:00
Niels Lohmann
e291c6c3d2 Merge branch 'develop' into feature/exceptions_3.0.0 2017-03-03 12:59:37 +01:00
Niels Lohmann
a1354184ce 📝 fixed typo #481 2017-03-03 12:56:54 +01:00
Niels Lohmann
0c6b1f8a24 Merge branch 'develop' into feature/exceptions_3.0.0 2017-03-03 12:54:45 +01:00
Niels Lohmann
776758d7a2 🔨 added user-defined exception 109
This exception occurs when a JSON pointer contains an array index that
can not be converted into a number.
2017-03-03 12:54:37 +01:00
Niels Lohmann
b86d2148ef 🔨 added user-defined exceptions 106-108
These exceptions occur when JSON pointers are malformed.
2017-03-03 11:56:58 +01:00
Niels Lohmann
06c788e4fd 📝 added missing word 2017-03-03 10:01:16 +01:00
Niels Lohmann
01d3a006b1 ⬆️ updated Catch to v1.8.1 2017-03-02 18:13:19 +01:00
Niels Lohmann
06815d274e 🔨 added user-defined exceptions 104 and 105
These exceptions are thrown in case of parse errors in JSON patch
documents.
2017-03-02 17:55:13 +01:00
Niels Lohmann
c085e3bac2 🔨 started with user-defined exceptions #301 #244
Added class hierarchy for user-defined exceptions (#244). Integrated
parse exceptions 101-103. Parse exceptions include the byte count of
the last read character to locate the position of the error (#301).
2017-03-01 21:28:44 +01:00
Niels Lohmann
7b8fd864e2 🔥 removed deprecated constructor #480
The constructor basic_json(std::istream&, const parser_callback_t) has
been deprecated since version 2.0.0. This commit removes it together
with its code example, deprecation macro, and test cases. The code now
also compiles with -W-deprecated-declarations.
2017-03-01 17:49:03 +01:00
Niels Lohmann
6b3912d936 📝 added note to 3.0.0 wiki page #474
I created a wiki page
https://github.com/nlohmann/json/wiki/Road-toward-3.0.0 to describe the
transition toward version 3.0.0. On this page, all API-breaking changes
shall be documented.
2017-03-01 17:26:32 +01:00
Niels Lohmann
f84ac523aa 📝 added a note to ordered maps
The library does not preserve the insertion order of object keys. There
are frequent requests to change the library in this aspect. The README
and the contribution guidelines now contain links to containers that
can be used to replace std::map to preserve the insertion order.
2017-03-01 10:15:07 +01:00
Niels Lohmann
41f9b32554 🔀 merge branch 'feature/serialization_class' into develop (#418)
Moved all dump()-related functions into a class "serializer". This fix includes a lot of performance improvements yielding a 7% speedup for serialization. Details on the individual steps can be found in the commit messages.

Individual benchmark numbers:

before:

dump jeopardy.json                            5   374555228 ns/op
dump jeopardy.json with indent                5   430953700 ns/op
dump numbers/floats.json                      5   622938509 ns/op
dump numbers/signed_ints.json                20    82177979 ns/op

after:

dump jeopardy.json                            5   335449757 ns/op -11%
dump jeopardy.json with indent                5   375467773 ns/op -13%
dump numbers/floats.json                      5   584611852 ns/op -7%
dump numbers/signed_ints.json                20    68289574 ns/op -17%
2017-02-28 21:04:16 +01:00
Niels Lohmann
d69242c6ba 💄 cleanup
- Added comments for the serializer class.
- Added test case for resizing of the indentation string.
- Using std::none_of to check if “.0” needs to be added to
floating-point number.
2017-02-28 19:20:50 +01:00
Niels Lohmann
059f21aada 💄 fixed a warning
snprintf returns an int, but we later assign it a difference_type which
is usually a long.
2017-02-28 17:24:03 +01:00
Niels Lohmann
224f99070b micro-optimization of dump()
A lot of small changes to avoid memory allocations:

- The locale is only queried once rather than with every number
serialization.
- The indentation string is recycled between different calls.
- The string escape function avoids a copy if no escaping is necessary.
- The string escape and the space function use a complete switch case
instead of cascaded ifs.

Cachegrind measures some 15% performance improvement.
2017-02-28 16:28:22 +01:00
Niels Lohmann
fc48b8ac2b 🐛 fixed a logical error
Treated the size of the range as the number of thousand separators.
This logical error yielded a negative value for written_bytes and
eventually an infinite loop, as written_bytes was converted to an
unsigned value.
2017-02-28 11:45:38 +01:00
Niels Lohmann
af070744ae 🔨 integrating numtostr into serializer class
By merging numtostr into serializer, we can write directly to the
output stream. As a consequence, all stream calls are now unformatted.
2017-02-27 22:10:57 +01:00
Niels Lohmann
54ef5f7b47 🔨 moved serialization functions to serializer class
The class is currently just a wrapper for an std::ostream and collects
all functions related to serialization. The next step should be
recycling of variables to avoid repetitive initialization for each
recursive dump call.
2017-02-27 21:22:39 +01:00
Niels Lohmann
9c4919ff34 " micro-optimizations for dump()"
This reverts commit 909b439b03.
For some strange reason, the test suite crashes when compiled
with GCC.
2017-02-27 16:19:07 +01:00
Niels Lohmann
909b439b03 micro-optimizations for dump()
numtostr now directly writes to a stream. Return value of snprintf is
reused to avoid finding end of string. Cachegrind suggests a 1%
performance increase.
2017-02-27 14:58:10 +01:00
Niels Lohmann
0f04e42dd5 micro-optimizations for dump()
All ‘<<‘ calls have been replaced by write()/put() calls. The
indentation strings needs not to be resized. Cachegrind measures 1%
performance improvement.
2017-02-27 01:22:24 +01:00
Niels Lohmann
b1441f3485 micro-optimizations for dump()
Indentation string is recycled to avoid allocations. Comma-separation
in objects does not need an if any more. Cachegrind measures 1%
performance improvement.
2017-02-26 20:58:00 +01:00
Niels Lohmann
bd0326cbc1 micro-optimizations for dump()
Added separate code paths for normal output and pritty-printed output.
This allowed to remove most of the ifs along the way. Benchmarks and
cachegrind suggest a 10% performance improvement.
2017-02-26 16:55:54 +01:00
Niels Lohmann
ae155c4734 💄 cleanup 2017-02-26 14:45:41 +01:00
Niels Lohmann
bf4d744d1a more tests for meta() call 2017-02-26 14:34:58 +01:00
Niels Lohmann
d1b30250d6 added missing tests 2017-02-26 11:50:52 +01:00
Niels Lohmann
f1cd15ce7e avoid copying a string 2017-02-26 11:22:18 +01:00
Niels Lohmann
9ff0cc0f02 📝 updated documentation 2017-02-25 16:43:15 +01:00
Niels Lohmann
1b5867bdcf 🔀 merge branch 'release/2.1.1' into develop 2017-02-25 16:37:28 +01:00
Niels Lohmann
c0d511ea50 🔀 merge branch 'release/2.1.1' 2017-02-25 16:36:46 +01:00
Niels Lohmann
27c65b860b 🔖 version 2.1.1 2017-02-25 16:34:38 +01:00
Niels Lohmann
0234e53e23 📝 added section on used third-party tools 2017-02-22 20:48:52 +01:00
Niels Lohmann
b49ce351eb 💄 fixed some warnings 2017-02-22 20:48:29 +01:00
Niels Lohmann
a646c9c599 🔀 merge branch 'cotire' of https://github.com/tusharpm/json into tusharpm-cotire 2017-02-22 19:45:10 +01:00
Niels Lohmann
8cec55a271 🚧 fixed more warnings 2017-02-22 18:14:29 +01:00
Niels Lohmann
345a106d73 💄 cleanup 2017-02-22 16:56:56 +01:00
Niels Lohmann
967f9144d4 🚧 overworked fix for #465 2017-02-21 19:11:34 +01:00
Niels Lohmann
7d14f167b8 🚑 fix for #465 2017-02-20 22:48:27 +01:00
Niels Lohmann
b04543ecc5 🎨 fixed newlines 2017-02-20 21:56:10 +01:00
Niels Lohmann
1a6d7f5bca 🚧 try to fix some warnings in MSVC 2017-02-20 18:32:11 +01:00
Niels Lohmann
f7075be93a 🐛 reverted change for #464 2017-02-20 18:15:50 +01:00
Niels Lohmann
f2dfa09aec 🐛 fix for #464 2017-02-20 18:05:52 +01:00
Niels Lohmann
83a9c60dbd 🔨 refactored code to avoid using strcpy/strlen/strcat (#463) 2017-02-20 17:37:34 +01:00
Niels Lohmann
716485a965 🚧 removed decay (#448) 2017-02-20 16:27:16 +01:00
Niels Lohmann
7a4a16a7db 💄 updated header list 2017-02-20 16:20:45 +01:00
Niels Lohmann
1f72c38861 🚑 fix for #448 2017-02-19 21:26:53 +01:00
Niels Lohmann
83f1d2c81b added start index for from_cbor and from_msgpack (#462) 2017-02-19 21:17:05 +01:00
Niels Lohmann
4151f2d297 added test with thousands_sep 2017-02-19 20:08:01 +01:00
Niels Lohmann
5b53f03e7c Merge branch 'develop' into TurpentineDistillery-feature/locale_independent_num_to_str 2017-02-19 19:24:55 +01:00
Niels Lohmann
9a9d0ba3df 🚧 fixing warning C4293 (#453) 2017-02-19 17:47:20 +01:00
Tushar Maheshwari
5436407b7e 👷 Add cmake logic to Travis config
- get CMake for XCode 8.1 image
2017-02-19 13:38:08 +05:30
Tushar Maheshwari
85ce4d7b53 cmake compile time reduce using cotire
- Add prefix header
  - Include catch.hpp
  - Include json.hpp
    - Replace private with public for all json_unit files
- Move `unit.cpp` to an object library
- cotire issue: strip whitespace from CMAKE_INCLUDE_SYSTEM_FLAG_CXX
2017-02-19 13:35:54 +05:30
Niels Lohmann
d1479e47bb 💄 added assertion message 2017-02-18 11:01:03 +01:00
Niels Lohmann
513eb3ab5f 🚧 clean up 2017-02-18 11:00:18 +01:00
Niels Lohmann
0200f2dc62 🚧 fixing warning C4267 (#453) 2017-02-17 19:14:21 +01:00
Niels Lohmann
6408402ad2 🔀 merge #378 (for #362 and #454) 2017-02-16 09:24:45 +01:00
Niels Lohmann
057b1e606b 🔀 merged #415 (fix for #414) 2017-02-16 08:50:20 +01:00
Niels Lohmann
2c17c1b1b2 💄 cleanup 2017-02-16 08:01:01 +01:00
Niels Lohmann
973402c11e 🚧 replaced throws (#440) and _MAX/_MIN macros (#451) 2017-02-15 22:44:18 +01:00
Niels Lohmann
b9f3149451 🚑 fix for #452 2017-02-15 21:30:28 +01:00
Mihai STAN
6bf93b3d06 Merge remote-tracking branch 'upstream/develop' into develop 2017-02-15 15:00:25 +02:00
Niels Lohmann
82fb613763 📝 update after #302 2017-02-14 07:28:30 +01:00
Niels Lohmann
22b9a301d6 Merge pull request #450 from nlohmann/TurpentineDistillery-feature/locale_independent_str_to_num
TurpentineDistillery feature/locale independent str to num
2017-02-14 07:18:35 +01:00
Niels Lohmann
c95ff863bf ⬆️ updated Catch to v1.7.2 2017-02-13 18:55:11 +01:00
Niels Lohmann
265c5b5207 🔨 more work on the number parser 2017-02-13 18:51:23 +01:00
Niels Lohmann
b84705d557 improved test coverage 2017-02-12 20:14:43 +01:00
Niels Lohmann
c8191c8172 🔨 further cleanup 2017-02-12 18:50:17 +01:00
Niels Lohmann
c2d55109c1 🔨 make lexer distinguishes number types 2017-02-11 16:54:25 +01:00
Niels Lohmann
9f5dccbab5 💄 cleanup 2017-02-11 15:55:53 +01:00
Niels Lohmann
926af6d50b 🔀 merge branch 'develop' into TurpentineDistillery-feature/locale_independent_str_to_num 2017-02-11 15:17:47 +01:00
Niels Lohmann
ed8516dc39 👷 added Codacy badge 2017-02-09 17:38:02 +01:00
Niels Lohmann
c485d46cea 📝 screenshoots look ugly 2017-02-08 20:00:46 +01:00
Niels Lohmann
6fd77cea4a 📝 added screenshots 2017-02-08 19:22:19 +01:00
Niels Lohmann
0ffa18aab8 📝 listing projects using the library 2017-02-08 19:16:38 +01:00
Niels Lohmann
662a9b8f3c ✏️ fixed more typos 2017-02-08 18:19:41 +01:00
Niels Lohmann
4746a4c536 💄 minor change 2017-02-08 17:56:43 +01:00
Niels Lohmann
163f8397fd ✏️ fixed a typo #446 2017-02-05 17:11:26 +01:00
Niels Lohmann
8d88a1da2a 🔀 merged #379 and fixed conflicts 2017-02-05 13:13:41 +01:00
Niels Lohmann
d284c86dd1 uncommented some tests 2017-02-04 21:00:41 +01:00
Niels Lohmann
922fe693e1 ⬆️ updated Catch to v1.7.0 2017-02-04 15:30:28 +01:00
Niels Lohmann
1cfdc2a753 🐛 fixed test compilation 2017-02-04 08:25:55 +01:00
Niels Lohmann
77d6f70602 📝 acknowledgments for #442 and #445 2017-02-03 18:28:22 +01:00
Niels Lohmann
d6afaa8e16 📝 fixing a documentation issue #442 2017-02-03 18:15:37 +01:00
Niels Lohmann
5976caf032 improved test compilation speed #445 2017-02-03 18:09:55 +01:00
Niels Lohmann
16af771277 added roundtrip test for the Big List of Naughty Strings 2017-02-01 17:34:39 +01:00
Niels Lohmann
bf8fdac99a 👷 dropped Doozer.io support 2017-02-01 16:41:05 +01:00
Niels Lohmann
c75865d88c 🐛 fixed -Weffc++ warnings 2017-02-01 15:13:21 +01:00
Niels Lohmann
b210f2dbf4 💄 minor refactoring 2017-01-29 21:40:37 +01:00
Niels Lohmann
0164b10e10 added missing tests found by mutate++ 2017-01-29 17:18:58 +01:00
Niels Lohmann
affa3bf4e9 Merge pull request #439 from jaredgrubb/patch-2
README: adjust boost::optional example
2017-01-29 08:18:44 +01:00
Jared Grubb
f2873e6d3a README: adjust boost::optional example
The "from_json" example for boost::optional is not complete and should also handle the 'none' case.
2017-01-29 02:46:58 +00:00
Niels Lohmann
f642934b18 🔀 merge branch 'release/2.1.0' into develop 2017-01-28 18:43:01 +01:00
Niels Lohmann
1e99a0273f 🔀 merge branch 'release/2.1.0' 2017-01-28 18:42:27 +01:00
Niels Lohmann
6746a57524 📝 updated slides 2017-01-28 18:41:30 +01:00
Niels Lohmann
eb08e8b09b 📝 updated documentation 2017-01-28 18:20:12 +01:00
Niels Lohmann
4b5c61075f 📄 changes to let Github detect the license 2017-01-28 18:17:57 +01:00
Niels Lohmann
38e4935db0 📝 added example and documentation for the meta function 2017-01-28 17:12:29 +01:00
Niels Lohmann
cdde1a9436 🔖 set version to 2.1.0 2017-01-28 16:46:03 +01:00
Niels Lohmann
d870826811 🔖 set version to 2.1.0 2017-01-28 16:03:35 +01:00
Niels Lohmann
2f6260751c 📝 fixed #434 2017-01-27 18:50:52 +01:00
Niels Lohmann
42fa3f0568 🔀 merge pull request #435 (based on #338, #355, and #423)
conversion from/to user-defined types
2017-01-27 06:22:10 +01:00
Niels Lohmann
cd9701b123 💄 cleanup 2017-01-26 20:51:30 +01:00
Niels Lohmann
1305e03557 📝 fixed documentation 2017-01-26 19:39:34 +01:00
Niels Lohmann
77bb7af5d9 📝 added more documentation 2017-01-26 07:29:37 +01:00
Niels Lohmann
4d3053cd42 💄 some cleanup 2017-01-25 22:21:07 +01:00
Niels Lohmann
94d9b7bc86 📝 overworked documentation (re-added constructor examples) 2017-01-25 21:59:54 +01:00
Niels Lohmann
ec03c9c53e 📝 overworked docs #435 2017-01-25 19:01:31 +01:00
Mihai STAN
6198439f59 fix #414 - comparing to 0 literal
Overload comparison operators for all types that could be converted
to nullptr.
2017-01-24 22:33:37 +02:00
Niels Lohmann
4139bb6572 📝 adjusted test count 2017-01-24 15:20:20 +01:00
Niels Lohmann
c154f3133d 🚧 rephrased assertions 2017-01-24 15:02:35 +01:00
Niels Lohmann
50a3f3b301 📝 added nicer example 2017-01-24 14:55:51 +01:00
Niels Lohmann
781fd09f2d 📝 cleanup 2017-01-24 14:45:32 +01:00
Niels Lohmann
daf8dcdb32 📝 overworked README 2017-01-24 14:37:25 +01:00
Niels Lohmann
250e5bf43d 💄 overworked documentation and indentation 2017-01-24 13:47:33 +01:00
Niels Lohmann
030cf674ef 🚧 fixed a warning 2017-01-24 12:49:38 +01:00
Niels Lohmann
3857e55290 💄 ran "make pretty" 2017-01-24 12:43:43 +01:00
Théo DELRIEU
9f103d19d7 add implicit conversions test (operator T()) 2017-01-22 14:23:24 +01:00
Théo DELRIEU
9f8b270ed9 fix some warnings 2017-01-22 14:07:28 +01:00
Théo DELRIEU
9c6ef74a28 add static_asserts/remove the need for CopyConstructible in get 2017-01-21 19:12:40 +01:00
Théo DELRIEU
ba0b35f414 use typename U = uncvref_t where appropriate 2017-01-21 19:12:40 +01:00
Théo DELRIEU
37fd20b2eb put uncvref_t, enable_if_t, value_t and operator<(value_t) in detail 2017-01-21 19:12:40 +01:00
Théo DELRIEU
7d771c71ed put back type_name in basic_json
This can however not be done easily for value_t, since
external_constructor depends on it, as is operator< which was moved
outside basic_json too.
This is not really an issue, since all basic_json classes share the same
enum
2017-01-21 19:12:40 +01:00
Théo DELRIEU
f997758cad remove useless forward declaration of primitive_iterator_t 2017-01-21 19:12:40 +01:00
Théo DELRIEU
40ba5a8b7b remove inline keyword from anonymous namespace (not needed) 2017-01-21 19:12:40 +01:00
Théo DELRIEU
7f359017d2 rename template argument Json -> BasicJsonType 2017-01-21 19:12:40 +01:00
Théo DELRIEU
708eb9613b disable reserve tests when exceptions are disabled 2017-01-21 19:12:40 +01:00
Théo DELRIEU
889b269a4f rename template argument: BasicJson -> Json 2017-01-21 16:14:23 +01:00
Théo DELRIEU
a6b028286b move conjunction/disjunction to the top of detail 2017-01-21 16:14:23 +01:00
Théo DELRIEU
d566bb81c4 use switchs where appropriate 2017-01-21 16:14:23 +01:00
Théo DELRIEU
1e20887cff use JSON_THROW 2017-01-21 16:14:22 +01:00
Théo DELRIEU
447c6a670f run make re2c 2017-01-21 16:14:22 +01:00
Théo DELRIEU
3e15b551e0 run make pretty 2017-01-21 16:14:22 +01:00
Théo DELRIEU
fbac056c38 add readme 2017-01-21 16:14:22 +01:00
Théo DELRIEU
b56117b148 add noexcept tests 2017-01-21 16:14:22 +01:00
Théo DELRIEU
af94e712c7 add basic doxygen documentations 2017-01-21 16:14:22 +01:00
Théo DELRIEU
1d87097741 remove some boilerplate 2017-01-21 16:14:22 +01:00
Théo DELRIEU
e60e458a7e move static_const to the detail namespace 2017-01-21 16:14:22 +01:00
Théo DELRIEU
794dae8911 apply changes to json.hpp.re2c 2017-01-21 16:14:22 +01:00
Théo DELRIEU
68081cd112 remove useless file 2017-01-21 16:14:22 +01:00
Théo DELRIEU
07bc82d3a7 put const to the left 2017-01-21 16:14:22 +01:00
Théo DELRIEU
f1482d1f01 more tests in unit-udt 2017-01-21 16:14:22 +01:00
Théo DELRIEU
f2c71fafda minor message/comments tweak 2017-01-21 16:14:22 +01:00
Théo DELRIEU
63e4249e9f use a priority_tag instead of int and longs with sfinae-dispatch 2017-01-21 16:14:22 +01:00
Théo DELRIEU
b8012876a5 add noexcept checks, and some missing noexcepts 2017-01-21 16:14:22 +01:00
Théo DELRIEU
1554baa01d attempting to fix coverage. testing that reserve is called 2017-01-21 16:14:22 +01:00
Théo DELRIEU
a9d5ae4fad put back a specialization for containers with a reserve method 2017-01-21 16:14:22 +01:00
Théo DELRIEU
e247e01a6e use static_casts to silence MSVC warnings
Those warnings are not "fixed", but that's intentional.
Truncations are expected when ArithmeticType is not the same type than
number_unsigned_t (or another basic_json template argument)
2017-01-21 16:14:22 +01:00
Théo DELRIEU
d0d8070422 add static_asserts
remove some useless trailing return types and && to help MSVC
2017-01-21 16:14:22 +01:00
Théo DELRIEU
e678c075dd check for is_number_unsigned before is_number_integer 2017-01-21 16:14:22 +01:00
Théo DELRIEU
cb3d455bd2 do not const_cast when calling get_ptr 2017-01-21 16:14:22 +01:00
Théo DELRIEU
3494014ba0 new unit-udt.cpp tests 2017-01-21 16:14:22 +01:00
Théo DELRIEU
1f25ec5d36 add some constexpr + noexcept 2017-01-21 16:14:22 +01:00
Théo DELRIEU
29f9fe6ae9 remove one has_to/from_json template parameter 2017-01-21 16:14:22 +01:00
Théo DELRIEU
5839795725 remove useless helpers 2017-01-21 16:14:22 +01:00
Théo DELRIEU
b4cea6825d remove is_compatible_array_type_impl trait 2017-01-21 16:14:22 +01:00
Théo DELRIEU
b2543e06d8 removed is_compatible_float_type trait 2017-01-21 16:14:22 +01:00
Théo DELRIEU
be6b417c87 tweak SFINAE checks for internal types (see commit body)
only check for public types (iterators, json_pointer)

for private ones (m_array.iterator, primitive_iterator) simply double
parentheses on relevant Catch checks
2017-01-21 16:14:22 +01:00
Théo DELRIEU
317883b21b cleanup, details in body
removes:
- is_basic_json_compatible_type traits
- a useless operator=
- void_t
- disjunction

changes:
- is_compatible_object_type's first argument is BasicJson
2017-01-21 16:14:22 +01:00
Théo DELRIEU
4e8089b9de remove old get/get_impl overloads (doc removal is of course temporary) 2017-01-21 16:14:22 +01:00
Théo DELRIEU
7e6a6f978e replace constructor by from/to_json: array_t 2017-01-21 16:14:22 +01:00
Théo DELRIEU
c847e0eea2 replace constructor by from/to_json: array_t
- tweaked a bit how `get<container<json>>` is handled
- added a from_json overload for forward list
2017-01-21 16:14:22 +01:00
Théo DELRIEU
6d427acdde replace constructor by from/to_json: unscoped enum types
this also means that one can do: j.get<unscoped_enum>();
2017-01-21 16:14:22 +01:00
Théo DELRIEU
f00898331e replace constructor by from/to_json: number_integer_t 2017-01-21 16:14:22 +01:00
Théo DELRIEU
a32de3b528 replace constructor by from/to_json: number_unsigned_t
This commit forces a design change in custom JSONSerializer, which might
be temporary
2017-01-21 16:14:21 +01:00
Théo DELRIEU
d257149f36 replace constructor by from/to_json: number_float_t 2017-01-21 16:14:21 +01:00
Théo DELRIEU
bbe40641a3 replace constructor by from/to_json: string_t 2017-01-21 16:14:21 +01:00
Théo DELRIEU
6b89785fba replace constructor by from/to_json: boolean_t 2017-01-21 16:14:21 +01:00
Théo DELRIEU
c833b22b7b move type_name outside of basic_json, make it a friend 2017-01-21 16:14:21 +01:00
Théo DELRIEU
d359684f2b move enum class value_t outside of basic_json 2017-01-21 16:14:21 +01:00
Niels Lohmann
034d5ed97e 💄 some cleanup 2017-01-21 16:14:21 +01:00
Niels Lohmann
be1d3de49b 💄 moved changes to re2c file and ran make pretty 2017-01-21 16:14:21 +01:00
Théo DELRIEU
aa2679a8ce fix tests, avoid instantiating JSONSerializer when it will not be used 2017-01-21 16:14:21 +01:00
Théo DELRIEU
d5ee5830ed add more tests 2017-01-21 16:14:21 +01:00
Théo DELRIEU
1c21c87e6f use u8 prefix in unit-udt.cpp 2017-01-21 16:14:21 +01:00
Théo DELRIEU
7e750ec1fa fix msvc, by doubling parenthesis on catch assertions 2017-01-21 16:14:21 +01:00
Théo DELRIEU
3d405c6883 add support for enum classes 2017-01-21 16:14:21 +01:00
Théo DELRIEU
8e43d476d3 add more tests to unit-udt.cpp 2017-01-21 16:14:21 +01:00
Théo DELRIEU
f5cb089f89 add an enum constructor (quickfix) 2017-01-21 16:14:21 +01:00
Théo DELRIEU
1eafac7220 remove explicit keyword on udt-constructor 2017-01-21 16:14:21 +01:00
Théo Delrieu
c0c72b5b62 rewrite unit-udt: basic usage 2017-01-21 16:14:21 +01:00
Théo DELRIEU
60e6f822fa add support for non-default-constructible udt 2017-01-21 16:14:21 +01:00
Théo DELRIEU
e5999c6c82 add a few tests 2017-01-21 16:14:21 +01:00
Théo Delrieu
74bb11d92c remove some useless checks, format a bit, added some comments 2017-01-21 16:14:21 +01:00
Théo DELRIEU
907484fb43 format biggest lines 2017-01-21 16:14:21 +01:00
Théo Delrieu
47bc402113 only use conjunction & co when needed to avoid MSVC crashing 2017-01-21 16:14:21 +01:00
Théo DELRIEU
ee19acaf05 add is_compatible_basic_json_type trait 2017-01-21 16:14:21 +01:00
Théo Delrieu
9b401972a0 add a macro for has_xxx types 2017-01-21 16:14:21 +01:00
Théo DELRIEU
e2dbe7a69f correctly constrain basic_json udt constructor 2017-01-21 16:14:21 +01:00
Théo DELRIEU
0d91113ccf add negation, disjunction, and conjunction from C++17 2017-01-21 16:14:21 +01:00
Théo DELRIEU
88819449c2 remove constraints on JSONSerializer instances, constrain correctly new methods 2017-01-21 16:14:21 +01:00
Théo DELRIEU
23bd2bce35 add is_compatible_* traits 2017-01-21 16:14:21 +01:00
Théo DELRIEU
178441cdfd add basic test for custom serializer 2017-01-21 16:14:21 +01:00
Théo DELRIEU
2bc685f6b4 to_json and from_json takes both two arguments now
the first is the basic_json type, the second the user-defined type
2017-01-21 16:14:21 +01:00
Théo DELRIEU
837b81d672 renamed unit-constructor3.cpp to unit-udt.cpp 2017-01-21 16:14:21 +01:00
Théo DELRIEU
33abccf847 add template arguments for JSONSerializer 2017-01-21 16:14:21 +01:00
Théo DELRIEU
7dc268ef42 add first version for alternate implementation 2017-01-21 16:14:21 +01:00
Théo DELRIEU
4cdc61e493 move most SFINAE trickery in to/from_json_fn 2017-01-21 16:14:21 +01:00
Théo DELRIEU
03b391c37b remove has_destructor and has_json_traits, use decltype instead 2017-01-21 16:14:21 +01:00
Théo DELRIEU
12b4555b13 use uncvref_t<T> instead of remove_cv_t<remove_reference_t<T>>> 2017-01-21 16:14:21 +01:00
Théo DELRIEU
877d96c1d8 rename __static_const to _static_const (reserved identifier) 2017-01-21 16:14:21 +01:00
Théo DELRIEU
d54d6bb84c add alias templates to reduce boilerplate 2017-01-21 16:14:21 +01:00
Théo DELRIEU
fe628b585b anonymous namespace renamed to detail 2017-01-21 16:14:21 +01:00
Théo Delrieu
b443edf49e add first version support for user-defined types 2017-01-21 16:14:20 +01:00
Niels Lohmann
ce0b3fe5a3 🚧 made type_name() public 2017-01-21 16:12:17 +01:00
Niels Lohmann
145188f264 renaming did not help 2017-01-19 19:23:56 +01:00
Niels Lohmann
69be3fa842 📝 small documentation update 2017-01-19 18:19:20 +01:00
Niels Lohmann
5e3f9c8969 📄 help Github find the license 2017-01-19 17:09:55 +01:00
Niels Lohmann
e951d198f4 🔀 merge pull request #430 from vjon/patch-1
Fix documentation error
2017-01-19 07:42:29 +01:00
Jonathan Lee
046f6da82f Fix documentation error
Move comparison before "j.clear()" function call, such that the intended return value "true" is actually correct.
2017-01-18 11:43:14 -08:00
Niels Lohmann
bae8e70137 🔀 merge branch 'feature/noexceptions_2' into develop 2017-01-18 20:41:17 +01:00
Niels Lohmann
87c5e32e1f 🐛 fixed escaping 2017-01-16 22:46:49 +01:00
Niels Lohmann
a00149f8ee 🐛 fixed logic error 2017-01-16 22:36:58 +01:00
Niels Lohmann
1ab26ab367 option to switch off exceptions 2017-01-16 22:11:07 +01:00
Niels Lohmann
74cbd30cd0 📄 it's 2017 2017-01-16 20:04:47 +01:00
Niels Lohmann
a7f3938391 added Big List of Naughty Strings 2017-01-16 20:03:50 +01:00
Niels Lohmann
a9b4cb8bf8 🔀 merge branch 'feature/release_information' into develop #397 2017-01-12 21:37:31 +01:00
Niels Lohmann
3a9ccfac22 🚧 cleanup 2017-01-12 21:35:27 +01:00
Niels Lohmann
98ad3c3ac1 Merge branch 'develop' into feature/release_information 2017-01-12 21:30:08 +01:00
Niels Lohmann
0f03543861 ⬆️ upgraded to Catch 1.6.0 2017-01-11 22:23:02 +01:00
Niels Lohmann
e9bbf5aaba 🐛 forgot to remove a test case 2017-01-08 09:31:40 +01:00
Niels Lohmann
dd45ba6f89 🚧 renamed version() to meta() 2017-01-08 09:19:44 +01:00
Alex Astashyn
c236b596c9 Merge upstream/develop into feature/locale_independent_str_to_num 2017-01-04 19:20:16 -05:00
Alex Astashyn
949061079a Merge upstream/develop into feature/locale_independent_num_to_str 2017-01-04 18:55:19 -05:00
Niels Lohmann
e1b89dd1d6 Merge branch 'develop' into feature/release_information 2017-01-04 20:06:23 +01:00
Niels Lohmann
9f6c86f233 🐛 fix for #417 2017-01-04 18:54:44 +01:00
Niels Lohmann
4765070318 📝 added documentation wrt. UTF-8 strings #406 2017-01-04 18:07:46 +01:00
Niels Lohmann
cdd3b5a68c 🚑 fix for #416 2017-01-03 23:52:01 +01:00
Niels Lohmann
767637877b 💄 cleanup 2017-01-03 22:37:07 +01:00
Niels Lohmann
f8d640b185 👷 better support for OSS-Fuzz 2017-01-03 22:35:31 +01:00
Niels Lohmann
245a69d554 💄 ran clang-tidy 2017-01-03 21:33:23 +01:00
Niels Lohmann
ea4d71ee21 Merge branch 'develop' into feature/release_information 2017-01-02 17:26:00 +01:00
Niels Lohmann
528bc96d7e Merge branch 'develop' 2017-01-02 16:41:33 +01:00
Niels Lohmann
9755cc75b1 🔀 merge branch 'release/2.0.10' into develop 2017-01-02 16:38:23 +01:00
Niels Lohmann
1c98ce869c 🔀 merge branch 'release/2.0.10' 2017-01-02 16:37:52 +01:00
Niels Lohmann
7e2c4b3ead 📝 updated online link 2017-01-02 16:37:29 +01:00
Niels Lohmann
69c615e127 🔖 version bump to 2.0.10 2017-01-02 10:00:44 +01:00
Niels Lohmann
4d3bf433b4 🔖 updated ChangeLog 2017-01-02 09:56:21 +01:00
Niels Lohmann
8b46eb8ec0 📄 it's 2017 already 2017-01-02 09:40:00 +01:00
Niels Lohmann
6a20790056 📝 updated test count 2017-01-02 09:36:30 +01:00
Niels Lohmann
60b3703c62 🔖 version bump to 2.0.10 2017-01-02 09:35:57 +01:00
Niels Lohmann
d173517212 💄 clean up 2017-01-02 09:21:26 +01:00
Niels Lohmann
a3063c2419 🚧 added target to build all fuzzers 2017-01-01 21:51:36 +01:00
Niels Lohmann
db33629990 💄 cleanup after #410 2017-01-01 21:34:58 +01:00
Niels Lohmann
712529cd32 🔀 merge pull request #400 from andoma/develop
Add Doozer build badge
2017-01-01 19:47:33 +01:00
Niels Lohmann
09b91406c6 🔀 merge pull request #410 from Daniel599/feature/clang_sanitize
Feature/clang sanitize
2017-01-01 19:45:11 +01:00
Niels Lohmann
ab7d55e7ae 👷 removed failing test suites 2017-01-01 19:38:54 +01:00
Niels Lohmann
cf9bf2d913 🚑 fix for #411 and #412 2017-01-01 15:28:01 +01:00
Daniel Cohen
ff3221a375 #394 fixed memory leak in unit-allocator, found by clang's fsanitize 2016-12-30 15:21:25 +02:00
Niels Lohmann
328eb55dc4 🚧 started working on #397 2016-12-30 14:02:51 +01:00
Daniel Cohen
010ea126f3 going to try clang_sanitize with libstdc++ with g++-6 implementation
Conflicts:
	.travis.yml
	Makefile
2016-12-30 14:24:22 +02:00
Niels Lohmann
d7029c37aa improved test coverage 2016-12-30 13:04:33 +01:00
Niels Lohmann
f7575dee94 Merge branch 'develop' into feature/release_information 2016-12-30 12:29:01 +01:00
Niels Lohmann
42a8c64499 🔖 added version information 2016-12-30 12:28:52 +01:00
Niels Lohmann
f0edab2363 🚑 fix for #408 2016-12-29 17:00:02 +01:00
Niels Lohmann
383a29a924 🚑 fix for #407 2016-12-29 16:14:15 +01:00
Niels Lohmann
871cebaf84 🚑 fix for #405 2016-12-29 15:39:16 +01:00
Niels Lohmann
8381cd6020 🚑 removed unsafe call to strerror #403 2016-12-28 14:19:08 +01:00
Niels Lohmann
e4c2829aea 🔀 merge branch 'feature/fuzzer' into develop 2016-12-28 12:26:00 +01:00
Niels Lohmann
1dd99d04b6 Merge branch 'develop' into feature/fuzzer 2016-12-28 12:19:12 +01:00
Niels Lohmann
888f5b9f60 🚚 renamed test files to allow windows build 2016-12-28 12:18:48 +01:00
Niels Lohmann
55be721615 Merge branch 'develop' into feature/fuzzer 2016-12-28 12:11:51 +01:00
Niels Lohmann
acb7e0558d 🚑 fixed bugs detected by AFL-Fuzz 2016-12-28 12:09:15 +01:00
Niels Lohmann
e3b036348b 🚧 added targets for parallel AFL fuzzing 2016-12-25 16:36:43 +01:00
Niels Lohmann
1399abc583 🚧 added MessagePack fuzz target 2016-12-25 16:18:56 +01:00
Niels Lohmann
e4cc62e653 🐛 fixed Makefile to work with proper CBOR files 2016-12-25 16:07:10 +01:00
Niels Lohmann
6de9d4035a 🐛 fixed AFL driver to also read binary data 2016-12-25 16:06:56 +01:00
Niels Lohmann
dbdcb3fec8 🐛 fixed bug in CBOR/MessagePack deserialization 2016-12-25 16:06:36 +01:00
Niels Lohmann
6e129fbfb7 📝 some small documentation fixes 2016-12-25 14:39:08 +01:00
Niels Lohmann
f87f4c06f9 🚧 cleanup 2016-12-22 12:10:52 +01:00
Niels Lohmann
33be4e7f1f 🚧 cleanup 2016-12-22 12:08:36 +01:00
Niels Lohmann
a084e90f39 🔨 split AFL test in driver and test file 2016-12-22 11:09:26 +01:00
Niels Lohmann
048330b14b ⬆️ Catch v1.5.9 2016-12-22 09:37:15 +01:00
Niels Lohmann
22a6b956e8 📄 added license for Catch 2016-12-22 09:36:34 +01:00
Niels Lohmann
ad241a2260 🔨 moved third-party code into separate folder 2016-12-22 09:35:53 +01:00
Niels Lohmann
6e8791912f 🚧 added fuzzer from OSS-Fuzz 2016-12-22 09:09:40 +01:00
Niels Lohmann
69ed19e483 added libFuzzer 2016-12-22 09:08:50 +01:00
Niels Lohmann
7107072f71 👷 clang for fedora 2016-12-21 10:33:36 +01:00
Niels Lohmann
2cf0f299ad 👷 using clang where GCC is too old 2016-12-21 10:13:59 +01:00
Niels Lohmann
937cca762f 👷 forgot to install make 2016-12-21 09:54:11 +01:00
Niels Lohmann
91e45a8dd0 👷 the cmake of trusty is too old 2016-12-21 09:47:31 +01:00
Niels Lohmann
f78671de8e 👷 Fedora has no package "build-essential" 2016-12-21 09:33:16 +01:00
Niels Lohmann
2e5208d5cd 👷 there is no cmake in the osx image 2016-12-21 09:19:53 +01:00
Niels Lohmann
c6fbd305b0 👷 trying more doozer workers 2016-12-21 09:17:17 +01:00
Niels Lohmann
38597ac628 👷 added more builders 2016-12-20 23:04:07 +01:00
Andreas Smas
57b32d9773 Add Doozer build badge 2016-12-20 21:38:01 +01:00
Niels Lohmann
73b28e8f92 👷 fixing build command 2016-12-20 19:16:52 +01:00
Niels Lohmann
1178a8152a 👷 using cmake with Doozer 2016-12-20 19:13:19 +01:00
Niels Lohmann
0fffbb8488 👷 trying Doozer 2016-12-20 19:06:15 +01:00
Niels Lohmann
9952a3c456 👷 trying to fix coverity task 2016-12-18 18:17:26 +01:00
Niels Lohmann
0e55af23fc 🔀 Merge branch 'release/2.0.9' into develop 2016-12-16 21:35:28 +01:00
Niels Lohmann
6df60b0448 🔀 Merge branch 'release/2.0.9' 2016-12-16 21:34:54 +01:00
Niels Lohmann
57afd293aa 🔖 updated documentation 2016-12-16 21:34:37 +01:00
Niels Lohmann
a507b9b46a 🔖 updated documentation 2016-12-16 21:25:20 +01:00
Niels Lohmann
36dc786106 🔖 updated Changelog 2016-12-16 21:09:14 +01:00
Niels Lohmann
706be50596 📝 updated number of tests 2016-12-16 20:54:43 +01:00
Niels Lohmann
303e873ae8 🔖 bumped version to 2.0.9 2016-12-16 20:45:46 +01:00
Niels Lohmann
f6f7fed99a 🚨 removed some warnings 2016-12-16 18:57:19 +01:00
Niels Lohmann
f24e4f680e 🎨 cleanup after PR #395 2016-12-14 22:30:09 +01:00
Niels Lohmann
fe00b368ae 🔀 merge pull request #395 from Bosswestfalen/develop
Replace class iterator and const_iterator by using a single template class to reduce code.
2016-12-14 21:56:43 +01:00
Niels Lohmann
2f94c30bad added a regression test for #380 / #390 2016-12-13 21:46:07 +01:00
Niels Lohmann
4e2fb1a533 Merge pull request #390 from qwename/integer-overflow
🔀 fix issue #380: Signed integer overflow check
2016-12-13 21:26:53 +01:00
Niels Lohmann
dfafd2c259 👷 can't get clang sanitizer to work #394
See https://travis-ci.org/nlohmann/json/jobs/183684093 for a failing
build.
2016-12-13 21:23:59 +01:00
Bosswestfalen
92e28c3153 added missing changes in json.hpp.re2c 2016-12-13 20:30:56 +01:00
Niels Lohmann
c3fac19692 👷 another try for sanitizers #394 2016-12-13 19:41:36 +01:00
Niels Lohmann
3f089cab2b 👷 moved instructed build to "before_script" #394 2016-12-13 18:24:16 +01:00
Niels Lohmann
9b5411db57 👷 clang 3.9.0 is not working #394 2016-12-13 17:55:41 +01:00
Niels Lohmann
f5d4a9c4eb 👷 added Clang 3.9.0 and sanitizer build #394 2016-12-13 17:51:46 +01:00
Yixin Zhang
703d4baf8b Fixed conversion warnings
Use static_cast on digit.
2016-12-12 21:12:08 -05:00
Yixin Zhang
bd6422f583 Ran make pretty 2016-12-12 21:12:08 -05:00
Yixin Zhang
1e981115c9 Fix issue #380: Signed integer overflow check
Instead of checking something like `x * y + z > max` where `x * y` can
overflow, check for `x > (max - z) / y` instead.
2016-12-12 21:12:08 -05:00
Alex Astashyn
6fba52b6da Merged upstream/develop into feature/locale_independent_str_to_num 2016-12-12 20:27:15 -05:00
Alex Astashyn
5cad2006eb Tweaked check for preserved sign; added LCOV_EXCL_LINE 2016-12-12 20:15:57 -05:00
Alex Astashyn
65b9b0c429 Disabling snprintf pre-check, since can't get locale-specific behavior to manifest in AppVeyor 2016-12-12 19:50:21 -05:00
Alex Astashyn
0f8de48ddb Disabling strtod pre-check, since can't get locale-specific behavior to manifest in AppVeyor 2016-12-12 19:48:14 -05:00
Alex Astashyn
cd0b651d43 Tweaked check for preserved sign; added LCOV_EXCL_LINE 2016-12-12 19:46:47 -05:00
Niels Lohmann
79fa8b2f41 🚑 fix to address #389 2016-12-12 23:19:43 +01:00
Bosswestfalen
dd3f4f9b92 Replaced class iterator and class const_iterator with aliases of template <typename U> iter_impl. iter_impl has operator const_iterator to create an const_iterator from an iterator. 2016-12-12 19:26:45 +01:00
Niels Lohmann
447e01427d 🚨 fixed some warnings 2016-12-12 18:21:17 +01:00
Niels Lohmann
b8776e8613 🚑 fix for #393 2016-12-12 17:39:56 +01:00
Niels Lohmann
f6c21a1f20 📝 added note to example files 2016-12-12 08:25:08 +01:00
Niels Lohmann
5402458ff5 🚑 fixed an AddressSanitizer warning 2016-12-12 08:13:26 +01:00
Niels Lohmann
a25d570040 📝 added TOC to README #383 2016-12-11 19:42:36 +01:00
Niels Lohmann
ea7b40687b 📝 updated FAQ of the contribution guidelines #382 2016-12-11 16:36:39 +01:00
Niels Lohmann
b2991950a5 📝 added not wrt re2c version #390 2016-12-11 16:21:53 +01:00
Niels Lohmann
e906933f39 🔀 Merge branch 'feature/messagepack' into develop 2016-12-11 16:11:59 +01:00
Niels Lohmann
a59eb4868a 🔀 Merge branch 'develop' into feature/messagepack 2016-12-11 16:11:43 +01:00
Niels Lohmann
a9d7d315a5 📝 cleanup after #391 2016-12-11 16:06:52 +01:00
Niels Lohmann
446019aefd 🔀 merge pull request #391 from jaredgrubb/jgrubb-clang-doc-warning
Clang: quiet a warning
2016-12-11 16:04:27 +01:00
Niels Lohmann
6fa4f96ba3 📝 fixed two documentation warnings 2016-12-11 16:03:23 +01:00
Niels Lohmann
dc6fc3e079 📝 clean up and added documentation for #358 2016-12-11 13:36:08 +01:00
Niels Lohmann
fdce38fa79 fixed a test case 2016-12-11 00:39:26 +01:00
Niels Lohmann
e8c903294f more test cases for CBOR and msgpack 2016-12-11 00:05:29 +01:00
Niels Lohmann
41673e8fed 🐛 fixed CBOR code and added test cases 2016-12-10 23:12:57 +01:00
Jared Grubb
98d6e6e523 Clang: quiet a warning 2016-12-10 13:19:56 -08:00
Niels Lohmann
7e5d6af5c1 🔨 refactored msgpack code 2016-12-10 21:30:18 +01:00
Niels Lohmann
f1b95d78f9 🔨 refactored CBOR code to a switch 2016-12-10 19:29:45 +01:00
Niels Lohmann
d99c230f51 implemented indefinite-length CBOR types (#387) 2016-12-10 18:32:56 +01:00
Alex Astashyn
01930357f7 Tweaking unit test, as digits grouping is failing to be invoked in CI 2016-12-08 22:39:38 -05:00
Alex Astashyn
343c9f9baa Addressing compiler warnings 2016-12-08 22:36:18 -05:00
Alex Astashyn
1c029b97c0 Still trying to invoke locale-specific behavior in CI 2016-12-08 22:13:05 -05:00
Alex Astashyn
38499e84fc Removed unused struct; fixed comments 2016-12-08 21:38:14 -05:00
Niels Lohmann
6b84c4155c 🔨 refactored get_from_vector function
Snippet from http://stackoverflow.com/a/41031865/266378
2016-12-08 09:37:23 +01:00
Alex Astashyn
50f0484ad5 Added unit test for issue #378 2016-12-07 20:23:25 -05:00
Alex Astashyn
27d9740ad6 Tweaks to unit-test for issue #379 2016-12-07 19:55:07 -05:00
Alex Astashyn
0a4a6a8399 Refactored to avoid using exceptions, as there are plans to support exceptionless mode 2016-12-07 19:53:27 -05:00
Niels Lohmann
81a4272444 more test cases for CBOR 2016-12-07 23:14:37 +01:00
Niels Lohmann
3a0f5398a2 more CBOR test cases 2016-12-07 22:50:10 +01:00
Niels Lohmann
b7e0c12966 CBOR support for half-precision floats 2016-12-07 21:43:59 +01:00
Niels Lohmann
17c9b17a7e test cases from RFC 7049 #384 2016-12-07 21:25:22 +01:00
Niels Lohmann
aab9bbbb93 🐛 fix for CBOR (small integers) 2016-12-07 21:24:42 +01:00
Niels Lohmann
de289ea336 💚 another approach to the AppVeyor error 2016-12-07 19:15:05 +01:00
Niels Lohmann
81c43dca6a 💚 more AppVeyor fixes 2016-12-07 16:51:15 +01:00
Niels Lohmann
3f14a09e73 💚 another try to fix the AppVeyor build 2016-12-07 16:43:55 +01:00
Niels Lohmann
74571d531c 💚 still fixing the AppVeyor error 2016-12-07 16:34:02 +01:00
Niels Lohmann
2c7946f2bc 💚 hopefully fixed an error on AppVeyor 2016-12-07 16:21:22 +01:00
Niels Lohmann
8f6bfe5b32 🔨 refactored function to get numbers from byte vector 2016-12-07 14:47:06 +01:00
Niels Lohmann
474da6b28f :white_check_mark: more msgpack test cases 2016-12-07 13:47:08 +01:00
Niels Lohmann
be973e52bb more msgpack test cases 2016-12-07 09:19:46 +01:00
Niels Lohmann
a1693bfe48 Merge branch 'develop' into feature/messagepack 2016-12-07 08:39:57 +01:00
Alex Astashyn
6774457733 Trying to coerce setlocale to make snprintf use commas as delimiter some more 2016-12-06 22:59:12 -05:00
Alex Astashyn
d169598c6c simplified code a bit based on @gregmarr's suggestions 2016-12-06 22:20:48 -05:00
Alex Astashyn
d2e9ce270a Trying to coerce setlocale to make snprintf use commas as delimiter; the behavior appears to be compiler/platform-specific 2016-12-06 22:18:20 -05:00
Alex Astashyn
6e8da7d8c4 Added unit-test for issue #379 (locale-independent str-to-num) 2016-12-06 19:45:48 -05:00
Alex Astashyn
7a081244a5 Refactored preprocessing with a lambda instead of do{...}while(0) 2016-12-06 19:41:31 -05:00
Alex Astashyn
0c87d5d6b3 Refactored preprocessing with a lambda instead of do{...}while(0) 2016-12-06 19:41:05 -05:00
Alex Astashyn
d643360575 Bugfix: when working with C formatting functions we need to query C locales (localeconv) rather than std::locale 2016-12-06 00:43:12 -05:00
Alex Astashyn
738d462955 Bugfix: when working with C formatting functions we need to query C locales (localeconv) rather than std::locale 2016-12-06 00:23:58 -05:00
Alex Astashyn
82b82fd487 Addressing msvc-specific compilation issues. 2016-12-05 20:33:28 -05:00
Alex Astashyn
509447b4d5 Small bufix related to creation of fmt string for snprintf 2016-12-05 19:03:39 -05:00
Alex Astashyn
e41a956782 Alternative handling of integer types relying on strto[u]ll 2016-12-04 13:23:39 -05:00
Alex Astashyn
2197856395 Fixed suffixing .0 and modified the unit tests accordingly 2016-12-04 01:38:23 -05:00
Alex Astashyn
21cae35930 Added locale-independent numtostr 2016-12-04 01:27:22 -05:00
Alex Astashyn
c75efedc6e stylistic changes 2016-12-03 23:19:43 -05:00
Alex Astashyn
4eafaab816 Improved overflow detection; removed debugging output statements. 2016-12-03 22:54:36 -05:00
Alex Astashyn
6b78b5c2be Added strtonum for locale-independent number parsing 2016-12-03 19:05:09 -05:00
Niels Lohmann
bc28942101 🔖 Merge branch 'release/2.0.8' into develop 2016-12-02 20:07:43 +01:00
Niels Lohmann
272ebdc900 🔖 Merge branch 'release/2.0.8' 2016-12-02 20:07:14 +01:00
Niels Lohmann
44c0f811b1 🔖 version 2.0.8 2016-12-02 20:05:53 +01:00
Niels Lohmann
6c24caf282 📝 updated ChangeLog 2016-12-02 19:04:36 +01:00
Niels Lohmann
4adb8a81bf 📝 version bump 2016-12-02 18:39:35 +01:00
Niels Lohmann
60b7299fe1 📝 updated README 2016-12-02 18:02:38 +01:00
Niels Lohmann
8f563a5f81 Merge branch 'feature/emplace' into develop 2016-12-01 21:22:23 +01:00
Niels Lohmann
5c811b91f1 Merge branch 'develop' into feature/emplace 2016-12-01 21:17:40 +01:00
Niels Lohmann
ba3c5e1a25 more test cases 2016-11-29 09:49:05 +01:00
Niels Lohmann
c46b4ea990 more test cases 2016-11-29 08:37:27 +01:00
Niels Lohmann
e717492019 Merge branch 'feature/issue365' into develop 2016-11-29 07:46:14 +01:00
Niels Lohmann
bd252b2a09 Merge branch 'develop' into feature/issue365 2016-11-28 23:24:52 +01:00
Niels Lohmann
50f647c866 Merge branch 'develop' into feature/messagepack 2016-11-28 23:24:35 +01:00
Niels Lohmann
7b6bd585c1 Merge branch 'develop' into feature/emplace 2016-11-28 23:23:56 +01:00
Niels Lohmann
d563c21afe 📝 update documentation of Travis builders 2016-11-28 23:23:45 +01:00
Niels Lohmann
ee0f23fdc6 🚧 bug fixes and more tests 2016-11-28 23:20:03 +01:00
Niels Lohmann
286025497f 👷 removed retired images (https://blog.travis-ci.com/2016-11-17-retiring-some-osx-images/) 2016-11-28 22:16:33 +01:00
Niels Lohmann
aeb4f87a27 added return value for emplace (#349) 2016-11-28 18:33:46 +01:00
Niels Lohmann
6ecff31b7f Merge branch 'develop' into feature/emplace 2016-11-28 18:00:10 +01:00
Niels Lohmann
bc238124ee 🚧 further simplifications 2016-11-27 21:42:21 +01:00
Niels Lohmann
4c232fe12b 👷 added precondition for individual tests 2016-11-27 19:11:58 +01:00
Niels Lohmann
a820d688eb 🔨 refactored number-to-vector calls 2016-11-27 19:11:32 +01:00
Niels Lohmann
56843eb7ba Merge branch 'feature/individual_tests' into feature/messagepack 2016-11-27 18:28:23 +01:00
Niels Lohmann
93589e630c CBOR roundtrip tests 2016-11-27 17:47:56 +01:00
Niels Lohmann
2477b09cb9 🐛 Clang 3.9.0 seems to not work right now 2016-11-27 17:29:19 +01:00
Niels Lohmann
f860f323be 🚧 falling back to single unit test for coveralls 2016-11-27 17:09:05 +01:00
Niels Lohmann
71c1232e32 🐛 fixed YAML 2016-11-27 16:46:33 +01:00
Niels Lohmann
36c79113fb 🚧 fixing coveralls and valgrind targets 2016-11-27 16:45:24 +01:00
Niels Lohmann
e1f98fbfc0 🚧 splitting tests into several binaries 2016-11-27 16:19:26 +01:00
Niels Lohmann
a73f43a7a2 🚧 CBOR support (#358) 2016-11-27 00:10:04 +01:00
Niels Lohmann
eef408e5fb tests for CBOR 2016-11-27 00:09:24 +01:00
Niels Lohmann
87e088990b Merge branch 'develop' into feature/messagepack 2016-11-26 18:17:18 +01:00
Niels Lohmann
a8522f391a Merge branch 'develop' into feature/issue365 2016-11-26 12:45:50 +01:00
Niels Lohmann
2773038cf9 added improvements (#365) 2016-11-26 12:43:23 +01:00
Niels Lohmann
a791af30b4 Merge branch 'feature/filenotfound' into develop 2016-11-25 17:39:38 +01:00
Niels Lohmann
1ed510c232 Merge branch 'develop' into feature/filenotfound 2016-11-25 17:39:24 +01:00
Niels Lohmann
f194db9aa6 added assertion for warning from #368 2016-11-24 22:07:35 +01:00
Niels Lohmann
c39c36e6ad 💄 fixed indentation 2016-11-24 22:05:29 +01:00
Niels Lohmann
472d0045ba 📝 updating README after fixing #299 2016-11-24 21:56:21 +01:00
Niels Lohmann
1407bbf94c 💄 fixed indentation 2016-11-24 21:54:05 +01:00
Niels Lohmann
8014637ad1 added a test for EOF error (#367) 2016-11-24 21:53:41 +01:00
Niels Lohmann
dfc49e7afe 🐛 fixed a bug if parser was called with a stream at EOF (#367) 2016-11-24 21:45:10 +01:00
Niels Lohmann
4bd3b1b0ef Merge branch 'develop' into feature/issue365 2016-11-24 18:25:00 +01:00
Niels Lohmann
e3450cac72 📈 removing more variance of the benchmarks 2016-11-24 18:24:26 +01:00
Niels Lohmann
c3a610d32a 🔧 ignoring Clion files 2016-11-24 17:45:01 +01:00
Niels Lohmann
25548f85c9 👷 trying Coverity with Clang 3.6 (#299) 2016-11-24 17:25:05 +01:00
Niels Lohmann
4bb41d065b 🐛 parsing erroneous files yields an exception (#366) 2016-11-23 16:57:01 +01:00
Niels
5f4becb0f5 Merge branch 'develop' into feature/issue365 2016-11-23 08:48:54 +01:00
Niels
ed611119d9 📈 reducing benchmark variance (#365) 2016-11-23 08:47:40 +01:00
Niels
6cc2d58d69 🐛 hopefully fixing the crashes on Linux (#365) 2016-11-22 20:13:47 +01:00
Niels
f620d74919 added performance fixes (#365) 2016-11-22 07:26:11 +01:00
Niels
869f4c68d4 📝 updated thanks section 2016-11-22 07:25:40 +01:00
Niels
c34b41acd6 🐛 fixes crash in dump from static object (#359)
Merge branch 'feature/issue359' into develop
2016-11-22 06:57:58 +01:00
Niels
abce5c25bb 📝 cleaned comments and updated README 2016-11-21 23:38:17 +01:00
Niels
43dbe02d5b 🐛 fixing #359 2016-11-21 21:53:10 +01:00
Niels
edc81f3bc1 💚 restored test call 2016-11-16 22:49:25 +01:00
Niels
d362a07239 💚 moved sample.json to standard test suite to run it with Valgrind 2016-11-16 22:49:16 +01:00
Niels
a9744f3937 💚 is sample.json killing AppVeyor? 2016-11-16 22:08:21 +01:00
Niels
0c9ab9427f 💚 added verbose message to check AppVeyor build 2016-11-16 22:02:38 +01:00
Niels
05e916717b Merge branch 'develop' into feature/messagepack 2016-11-16 19:16:36 +01:00
Niels
693bfe439b Merge branch 'develop' into feature/emplace 2016-11-16 19:16:16 +01:00
Niels
0d72767b3e ⬆️ updated to Catch v1.5.8 2016-11-16 19:15:54 +01:00
Niels
56667af823 🎨 stating the name of the library in the license 2016-11-16 19:08:25 +01:00
Niels
0a908ce8e2 Merge branch 'develop' into feature/messagepack 2016-11-16 09:04:37 +01:00
Niels
b0f896558f Merge branch 'develop' into feature/emplace 2016-11-16 09:04:25 +01:00
Niels
425b9834a8 🐛 removed the wrong compiler 2016-11-16 08:25:08 +01:00
Niels
56671a88c6 🍎 removed Xcode 8.0 due to repeated problems 2016-11-16 08:01:48 +01:00
Niels
5316f0fff2 🍎 added Xcode 8.1 build for travis 2016-11-16 06:42:26 +01:00
Niels
1be73b903e proposal for emplace/emplace_back (#349) 2016-11-11 19:29:14 +01:00
Niels
d1e73ce954 hid an expensive test case 2016-11-11 17:31:37 +01:00
Niels
543745a10e starting to integrate MessagePack (#358) 2016-11-11 17:11:13 +01:00
Niels
79a9d00e15 Merge branch 'develop' 2016-11-03 18:54:59 +01:00
Niels
9ca00e4880 readded missing header 2016-11-03 07:27:32 +01:00
Niels
e385417047 documented and cleaned up headers (#314) 2016-11-02 21:27:19 +01:00
Niels
a4d13c92ba Merge branch 'release/2.0.7' 2016-11-02 20:52:24 +01:00
Niels
60bba02cc6 Merge branch 'release/2.0.6' 2016-10-15 16:47:56 +02:00
861 changed files with 1149213 additions and 20108 deletions

View File

@@ -14,8 +14,6 @@ Usually, all issues are tracked publicly on [Github](https://github.com/nlohmann
Please [create an issue](https://github.com/nlohmann/json/issues/new), assuming one does not already exist, and describe your concern. Note you need a [GitHub account](https://github.com/signup/free) for this.
If you want propose changes to the code, you need to download the [`re2c`](http://re2c.org) tool.
## Describe your issue
Clearly describe the issue:
@@ -24,33 +22,28 @@ 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 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 [issue template](https://github.com/nlohmann/json/blob/develop/.github/ISSUE_TEMPLATE.md) if possible.
## Files to change
There are currently two files which need to be edited:
1. [`src/json.hpp.re2c`](https://github.com/nlohmann/json/blob/master/src/json.hpp.re2c) (note the `.re2c` suffix) - This file contains a comment section which describes the JSON lexic. This section is translated by [`re2c`](http://re2c.org) into file [`src/json.hpp`](https://github.com/nlohmann/json/blob/master/src/json.hpp) which is plain "vanilla" C++11 code. (In fact, the generated lexer consists of some hundred lines of `goto`s, which is a hint you never want to edit this file...).
1. [`src/json.hpp`](https://github.com/nlohmann/json/blob/master/src/json.hpp)
If you only edit file `src/json.hpp` (without the `.re2c` suffix), your changes will be overwritten as soon as the lexer is touched again. To generate the `src/json.hpp` file which is actually used during compilation of the tests and all other code, please execute
```sh
make re2c
```
To run [`re2c`](http://re2c.org) and generate/overwrite file `src/json.hpp` with your changes in file `src/json.hpp.re2c`.
2. [`test/src/unit.cpp`](https://github.com/nlohmann/json/blob/master/test/unit.cpp) - This contains the [Catch](https://github.com/philsquared/Catch) unit tests which currently cover [100 %](https://coveralls.io/github/nlohmann/json) of the library's code.
2. [`test/src/unit-*.cpp`](https://github.com/nlohmann/json/tree/develop/test/src) - These files contain the [Catch](https://github.com/philsquared/Catch) 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
```sh
make check
$ mkdir build
$ cd build
$ cmake ..
$ cmake --build .
$ ctest
```
The test cases are also executed with several different compilers on [Travis](https://travis-ci.org/nlohmann/json) once you open a pull request.
Please understand that I cannot accept pull requests changing only file `src/json.hpp`.
## Note
@@ -59,10 +52,12 @@ Please understand that I cannot accept pull requests changing only file `src/jso
## Please don't
- Only make changes to file `src/json.hpp` -- please read the paragraph above and understand why `src/json.hpp.re2c` exists.
- The C++11 support varies between different **compilers** and versions. Please note the [list of supported compilers](https://github.com/nlohmann/json/blob/master/README.md#supported-compilers). Some compilers like GCC 4.8 (and earlier), Clang 3.3 (and earlier), or Microsoft Visual Studio 13.0 and earlier are known not to work due to missing or incomplete C++11 support. Please refrain from proposing changes that work around these compiler's limitations with `#ifdef`s or other means.
- Specifically, I am aware of compilation problems with **Microsoft Visual Studio** (there even is an [issue label](https://github.com/nlohmann/json/issues?utf8=✓&q=label%3A%22visual+studio%22+) for these kind of bugs). I understand that even in 2016, complete C++11 support isn't there yet. But please also understand that I do not want to drop features or uglify the code just to make Microsoft's sub-standard compiler happy. The past has shown that there are ways to express the functionality such that the code compiles with the most recent MSVC - unfortunately, this is not the main objective of the project.
- Please refrain from proposing changes that would **break [JSON](http://json.org) conformance**. If you propose a conformant extension of JSON to be supported by the library, please motivate this extension.
- We shall not extend the library to **support comments**. There is quite some [controversy](https://www.reddit.com/r/programming/comments/4v6chu/why_json_doesnt_support_comments_douglas_crockford/) around this topic, and there were quite some [issues](https://github.com/nlohmann/json/issues/376) on this. We believe that JSON is fine without comments.
- We do not preserve the **insertion order of object elements**. The [JSON standard](https://tools.ietf.org/html/rfc7159.html) defines objects as "an unordered collection of zero or more name/value pairs". To this end, this library does not preserve insertion order of name/value pairs. (In fact, keys will be traversed in alphabetical order as `std::map` with `std::less` is used by default.) Note this behavior conforms to the standard, and we shall not change it to any other order. If you do want to preserve the insertion order, you can specialize the object type with containers like [`tsl::ordered_map`](https://github.com/Tessil/ordered-map) or [`nlohmann::fifo_map`](https://github.com/nlohmann/fifo_map).
- Please do not open pull requests that address **multiple issues**.
## Wanted

22
.github/ISSUE_TEMPLATE.md vendored Normal file
View File

@@ -0,0 +1,22 @@
**Bug Report**
- What is the issue you have?
- Please describe the steps to reproduce the issue. Can you provide a small but working code example?
- What is the expected behavior?
- And what is the actual behavior instead?
- Which compiler and operating system are you using? Is it a [supported compiler](https://github.com/nlohmann/json#supported-compilers)?
- Did you use a released version of the library or the version from the `develop` branch?
- If you experience a compilation error: can you [compile and run the unit tests](https://github.com/nlohmann/json#execute-unit-tests)?
**Feature Request**
- Describe the feature in as much detail as possible.
- Include sample usage where appropriate.

View File

@@ -1,45 +1,15 @@
[Describe your pull request here. Please read the text below the line, and make sure you follow the checklist.]
## Files to change
* * *
There are currently two files which need to be edited:
## Pull request checklist
1. [`src/json.hpp.re2c`](https://github.com/nlohmann/json/blob/master/src/json.hpp.re2c) (note the `.re2c` suffix) - This file contains a comment section which describes the JSON lexic. This section is translated by [`re2c`](http://re2c.org) into file [`src/json.hpp`](https://github.com/nlohmann/json/blob/master/src/json.hpp) which is plain "vanilla" C++11 code. (In fact, the generated lexer consists of some hundred lines of `goto`s, which is a hint you never want to edit this file...).
If you only edit file `src/json.hpp` (without the `.re2c` suffix), your changes will be overwritten as soon as the lexer is touched again. To generate the `src/json.hpp` file which is actually used during compilation of the tests and all other code, please execute
```sh
make re2c
```
To run [`re2c`](http://re2c.org) and generate/overwrite file `src/json.hpp` with your changes in file `src/json.hpp.re2c`.
2. [`test/src/unit.cpp`](https://github.com/nlohmann/json/blob/master/test/unit.cpp) - This contains the [Catch](https://github.com/philsquared/Catch) 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 with
```sh
make
```
and can be executed with
```sh
./json_unit
```
The test cases are also executed with several different compilers on [Travis](https://travis-ci.org/nlohmann/json) once you open a pull request.
Please understand that I cannot accept pull requests changing only file `src/json.hpp`.
## Note
- If you open a pull request, the code will be automatically tested with [Valgrind](http://valgrind.org)'s Memcheck tool to detect memory leaks. Please be aware that the execution with Valgrind _may_ in rare cases yield different behavior than running the code directly. This can result in failing unit tests which run successfully without Valgrind.
- [ ] 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.
- [ ] [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).
## Please don't
- Only make changes to file `src/json.hpp` -- please read the paragraph above and understand why `src/json.hpp.re2c` exists.
- The C++11 support varies between different **compilers** and versions. Please note the [list of supported compilers](https://github.com/nlohmann/json/blob/master/README.md#supported-compilers). Some compilers like GCC 4.8 (and earlier), Clang 3.3 (and earlier), or Microsoft Visual Studio 13.0 and earlier are known not to work due to missing or incomplete C++11 support. Please refrain from proposing changes that work around these compiler's limitations with `#ifdef`s or other means.
- Specifically, I am aware of compilation problems with **Microsoft Visual Studio** (there even is an [issue label](https://github.com/nlohmann/json/issues?utf8=✓&q=label%3A%22visual+studio%22+) for these kind of bugs). I understand that even in 2016, complete C++11 support isn't there yet. But please also understand that I do not want to drop features or uglify the code just to make Microsoft's sub-standard compiler happy. The past has shown that there are ways to express the functionality such that the code compiles with the most recent MSVC - unfortunately, this is not the main objective of the project.
- Please refrain from proposing changes that would **break [JSON](http://json.org) conformance**. If you propose a conformant extension of JSON to be supported by the library, please motivate this extension.

19
.github/config.yml vendored Normal file
View File

@@ -0,0 +1,19 @@
# Configuration for sentiment-bot - https://github.com/behaviorbot/sentiment-bot
# *Required* toxicity threshold between 0 and .99 with the higher numbers being the most toxic
# Anything higher than this threshold will be marked as toxic and commented on
sentimentBotToxicityThreshold: .7
# *Required* Comment to reply with
sentimentBotReplyComment: >
Please be sure to review the [code of conduct](https://github.com/nlohmann/json/blob/develop/CODE_OF_CONDUCT.md) and be respectful of other users. cc/ @nlohmann
# Configuration for request-info - https://github.com/behaviorbot/request-info
# *Required* Comment to reply with
requestInfoReplyComment: >
We would appreciate it if you could provide us with more info about this issue or pull request! Please check the [issue template](https://github.com/nlohmann/json/blob/develop/.github/ISSUE_TEMPLATE.md) and the [pull request template](https://github.com/nlohmann/json/blob/develop/.github/PULL_REQUEST_TEMPLATE.md).
# *OPTIONAL* Label to be added to Issues and Pull Requests with insufficient information given
requestInfoLabelToAdd: "state: needs more info"

17
.github/stale.yml vendored Normal file
View File

@@ -0,0 +1,17 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 30
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 7
# Issues with these labels will never be considered stale
exemptLabels:
- pinned
- security
# Label to use when marking an issue as stale
staleLabel: "state: stale"
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false

9
.gitignore vendored
View File

@@ -1,5 +1,6 @@
json_unit
json_benchmarks
json_benchmarks_simple
fuzz-testing
*.dSYM
@@ -7,10 +8,16 @@ fuzz-testing
*.gcno
*.gcda
working
build
build_coverage
doc/xml
doc/html
me.nlohmann.json.docset
benchmarks/files/numbers/*.json
.idea
cmake-build-debug
test/test-*

View File

@@ -7,6 +7,7 @@ language: cpp
dist: trusty
sudo: required
group: edge
###################
@@ -28,21 +29,28 @@ matrix:
include:
# Valgrind
- os: linux
compiler: gcc
env:
- COMPILER=g++-4.9
- SPECIAL=valgrind
- CMAKE_OPTIONS=-DJSON_Valgrind=ON
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: [g++-4.9, valgrind]
after_success:
- valgrind --error-exitcode=1 --leak-check=full test/json_unit
packages: ['g++-4.9', 'valgrind', 'ninja-build']
# clang sanitizer
- os: linux
compiler: clang
env:
- COMPILER=clang++-5.0
- CMAKE_OPTIONS=-DJSON_Sanitizer=ON
addons:
apt:
sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-trusty-5.0']
packages: ['g++-6', 'clang-5.0', 'ninja-build']
# cppcheck
- os: linux
compiler: gcc
env:
@@ -51,10 +59,21 @@ matrix:
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: [g++-4.9, cppcheck]
packages: ['g++-4.9', 'cppcheck', 'ninja-build']
after_success:
- make cppcheck
# no exceptions
- os: linux
compiler: gcc
env:
- COMPILER=g++-4.9
- CMAKE_OPTIONS=-DJSON_NoExceptions=ON
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-4.9', 'ninja-build']
# Coveralls (http://gronlier.fr/blog/2015/01/adding-code-coverage-to-your-c-project/)
- os: linux
@@ -62,72 +81,65 @@ matrix:
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-4.9', 'ruby']
packages: ['g++-4.9', 'ninja-build']
before_script:
- wget http://ftp.de.debian.org/debian/pool/main/l/lcov/lcov_1.11.orig.tar.gz
- tar xf lcov_1.11.orig.tar.gz
- sudo make -C lcov-1.11/ install
- gem install coveralls-lcov
- pip install --user cpp-coveralls
after_success:
- make clean
- CXXFLAGS="--coverage -g -O0" CPPFLAGS="-DNDEBUG" make
- test/json_unit "*"
- coveralls --build-root test --exclude src/catch.hpp --exclude src/unit-algorithms.cpp --exclude src/unit-allocator.cpp --exclude src/unit-capacity.cpp --exclude src/unit-class_const_iterator.cpp --exclude src/unit-class_iterator.cpp --exclude src/unit-class_lexer.cpp --exclude src/unit-class_parser.cpp --exclude src/unit-comparison.cpp --exclude src/unit-concepts.cpp --exclude src/unit-constructor1.cpp --exclude src/unit-constructor2.cpp --exclude src/unit-convenience.cpp --exclude src/unit-conversions.cpp --exclude src/unit-deserialization.cpp --exclude src/unit-element_access1.cpp --exclude src/unit-element_access2.cpp --exclude src/unit-inspection.cpp --exclude src/unit-iterator_wrapper.cpp --exclude src/unit-iterators1.cpp --exclude src/unit-iterators2.cpp --exclude src/unit-json_patch.cpp --exclude src/unit-json_pointer.cpp --exclude src/unit-modifiers.cpp --exclude src/unit-pointer_access.cpp --exclude src/unit-readme.cpp --exclude src/unit-reference_access.cpp --exclude src/unit-regression.cpp --exclude src/unit-serialization.cpp --exclude src/unit-testsuites.cpp --exclude src/unit-unicode.cpp --include ../src/json.hpp --gcov-options '\-lp' --gcov 'gcov-4.9'
- lcov --directory src --directory test/src --capture --output-file coverage.info --rc lcov_branch_coverage=1 --no-external
- lcov --remove coverage.info 'test/src/*' --output-file coverage.info --rc lcov_branch_coverage=1
- lcov --list coverage.info --rc lcov_branch_coverage=1
- coveralls-lcov --repo-token F9bs4Nop10JRgqPQXRcifyQKYhb3FczkS coverage.info
- coveralls --build-root test --include src --gcov 'gcov-4.9' --gcov-options '\-lp'
env:
- COMPILER=g++-4.9
- SPECIAL=coveralls
- CMAKE_OPTIONS=-DJSON_Coverage=ON
# Coverity (only for branch coverity_scan)
- os: linux
compiler: gcc
compiler: clang
before_install: echo -n | openssl s_client -connect scan.coverity.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | sudo tee -a /etc/ssl/certs/ca-certificates.crt
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-5', 'valgrind']
sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.6']
packages: ['g++-6', 'clang-3.6', 'ninja-build']
coverity_scan:
project:
name: "nlohmann/json"
description: "Build submitted via Travis CI"
notification_email: niels.lohmann@gmail.com
build_command_prepend: "make clean ; sudo cp $(which g++-5) $(which g++)"
build_command: "make"
build_command_prepend: "mkdir coverity_build ; cd coverity_build ; cmake .. ; cd .."
build_command: "make -C coverity_build"
branch_pattern: coverity_scan
env:
- COMPILER=g++-5
- SPECIAL=coverity
- COMPILER=clang++-3.6
# OSX / Clang
- os: osx
osx_image: beta-xcode6.1
- os: osx
osx_image: beta-xcode6.2
- os: osx
osx_image: beta-xcode6.3
- os: osx
osx_image: xcode6.4
- os: osx
osx_image: xcode7.1
- os: osx
osx_image: xcode7.2
- os: osx
osx_image: xcode7.3
- os: osx
osx_image: xcode8
- os: osx
osx_image: xcode8.1
- os: osx
osx_image: xcode8.2
- os: osx
osx_image: xcode8.3
- os: osx
osx_image: xcode9
- os: osx
osx_image: xcode9.1
- os: osx
osx_image: xcode9.2
# Linux / GCC
- os: linux
@@ -136,7 +148,7 @@ matrix:
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: g++-4.9
packages: ['g++-4.9', 'ninja-build']
- os: linux
compiler: gcc
@@ -144,7 +156,7 @@ matrix:
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: g++-5
packages: ['g++-5', 'ninja-build']
- os: linux
compiler: gcc
@@ -152,104 +164,119 @@ matrix:
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: g++-6
packages: ['g++-6', 'ninja-build']
- os: linux
compiler: gcc
env: COMPILER=g++-7
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-7', 'ninja-build']
- os: linux
compiler: gcc
env:
- COMPILER=g++-7
- CXXFLAGS=-std=c++17
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-7', 'ninja-build']
# Linux / Clang
- os: linux
env: LLVM_VERSION=3.6.0
compiler: clang
env: COMPILER=clang++-3.5
addons:
apt:
sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.5']
packages: ['g++-6', 'clang-3.5', 'ninja-build']
- os: linux
env: LLVM_VERSION=3.6.1
compiler: clang
env: COMPILER=clang++-3.6
addons:
apt:
sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.6']
packages: ['g++-6', 'clang-3.6', 'ninja-build']
- os: linux
env: LLVM_VERSION=3.6.2
compiler: clang
env: COMPILER=clang++-3.7
addons:
apt:
sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.7']
packages: ['g++-6', 'clang-3.7', 'ninja-build']
- os: linux
env: LLVM_VERSION=3.7.0
compiler: clang
env: COMPILER=clang++-3.8
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-6', 'clang-3.8', 'ninja-build']
- os: linux
env: LLVM_VERSION=3.7.1
compiler: clang
env: COMPILER=clang++-3.9
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-6', 'clang-3.9', 'ninja-build']
- os: linux
env: LLVM_VERSION=3.8.0
compiler: clang
env: COMPILER=clang++-4.0
addons:
apt:
sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-trusty-4.0']
packages: ['g++-6', 'clang-4.0', 'ninja-build']
- os: linux
env: LLVM_VERSION=3.8.1
compiler: clang
env: COMPILER=clang++-5.0
addons:
apt:
sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-trusty-5.0']
packages: ['g++-6', 'clang-5.0', 'ninja-build']
#####################
# installation step #
#####################
# set directories to cache
cache:
directories:
- ${TRAVIS_BUILD_DIR}/deps/llvm-3.6.2
- ${TRAVIS_BUILD_DIR}/deps/llvm-3.6.1
- ${TRAVIS_BUILD_DIR}/deps/llvm-3.6.0
- ${TRAVIS_BUILD_DIR}/deps/llvm-3.7.0
- ${TRAVIS_BUILD_DIR}/deps/llvm-3.7.1
- ${TRAVIS_BUILD_DIR}/deps/llvm-3.8.0
- ${TRAVIS_BUILD_DIR}/deps/llvm-3.8.1
install:
# create deps dir if not existing
- DEPS_DIR="${TRAVIS_BUILD_DIR}/deps"
- mkdir -p ${DEPS_DIR}
# make sure CXX is correctly set
- if [[ "${COMPILER}" != "" ]]; then export CXX=${COMPILER}; fi
# install LLVM/clang when LLVM_VERSION is set
- |
if [[ "${LLVM_VERSION}" != "" ]]; then
LLVM_DIR=${DEPS_DIR}/llvm-${LLVM_VERSION}
if [[ -z "$(ls -A ${LLVM_DIR})" ]]; then
travis_retry wget --quiet https://cmake.org/files/v3.6/cmake-3.6.1.tar.gz
tar xfz cmake-3.6.1.tar.gz
(cd cmake-3.6.1 && ./configure --prefix=${LLVM_DIR}/cmake && make install)
export PATH="${LLVM_DIR}/cmake/bin:${PATH}"
LLVM_URL="http://llvm.org/releases/${LLVM_VERSION}/llvm-${LLVM_VERSION}.src.tar.xz"
LIBCXX_URL="http://llvm.org/releases/${LLVM_VERSION}/libcxx-${LLVM_VERSION}.src.tar.xz"
LIBCXXABI_URL="http://llvm.org/releases/${LLVM_VERSION}/libcxxabi-${LLVM_VERSION}.src.tar.xz"
CLANG_URL="http://llvm.org/releases/${LLVM_VERSION}/clang+llvm-${LLVM_VERSION}-x86_64-linux-gnu-ubuntu-14.04.tar.xz"
mkdir -p ${LLVM_DIR} ${LLVM_DIR}/build ${LLVM_DIR}/projects/libcxx ${LLVM_DIR}/projects/libcxxabi ${LLVM_DIR}/clang
travis_retry wget --quiet -O - ${LLVM_URL} | tar --strip-components=1 -xJ -C ${LLVM_DIR}
travis_retry wget --quiet -O - ${LIBCXX_URL} | tar --strip-components=1 -xJ -C ${LLVM_DIR}/projects/libcxx
travis_retry wget --quiet -O - ${LIBCXXABI_URL} | tar --strip-components=1 -xJ -C ${LLVM_DIR}/projects/libcxxabi
travis_retry wget --quiet -O - ${CLANG_URL} | tar --strip-components=1 -xJ -C ${LLVM_DIR}/clang
(cd ${LLVM_DIR}/build && cmake .. -DCMAKE_INSTALL_PREFIX=${LLVM_DIR}/install -DCMAKE_CXX_COMPILER=clang++)
(cd ${LLVM_DIR}/build/projects/libcxx && make install -j2)
(cd ${LLVM_DIR}/build/projects/libcxxabi && make install -j2)
fi
export CXXFLAGS="-nostdinc++ -isystem ${LLVM_DIR}/install/include/c++/v1"
export LDFLAGS="-L ${LLVM_DIR}/install/lib -l c++ -l c++abi"
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${LLVM_DIR}/install/lib"
export PATH="${LLVM_DIR}/clang/bin:${PATH}"
fi
- os: linux
compiler: clang
env:
- COMPILER=clang++-5.0
- CXXFLAGS=-std=c++1z
addons:
apt:
sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-trusty-5.0']
packages: ['g++-6', 'clang-5.0', 'ninja-build']
################
# build script #
################
script:
# get CMake and Ninja (only for systems with brew - macOS)
- |
if [[ (-x $(which brew)) ]]; then
brew update
brew install cmake ninja
cmake --version
fi
# make sure CXX is correctly set
- if [[ "${COMPILER}" != "" ]]; then export CXX=${COMPILER}; fi
# show OS/compiler version
- uname -a
- $CXX --version
# compile
- make
# execute unit tests
- test/json_unit "*"
# compile and execute unit tests
- mkdir -p build && cd build
- cmake .. ${CMAKE_OPTIONS} -GNinja && cmake --build . --config Release
- ctest -C Release -V -j
- cd ..
# check if homebrew works (only checks develop branch)
- if [ `which brew` ]; then
@@ -258,51 +285,3 @@ script:
brew install nlohmann_json --HEAD ;
brew test nlohmann_json ;
fi
#language: cpp
#
#dist: trusty
#sudo: required
#
#env:
# global:
# # The next declaration is the encrypted COVERITY_SCAN_TOKEN, created
# # via the "travis encrypt" command using the project repo's public key
# - secure: "m89SSgE+ASLO38rSKx7MTXK3n5NkP9bIx95jwY71YEiuFzib30PDJ/DifKnXxBjvy/AkCGztErQRk/8ZCvq+4HXozU2knEGnL/RUitvlwbhzfh2D4lmS3BvWBGS3N3NewoPBrRmdcvnT0xjOGXxtZaJ3P74TkB9GBnlz/HmKORA="
#
## from http://stackoverflow.com/a/32127147/266378
#matrix:
# include:
# - os: linux
# compiler: gcc
# addons:
# apt:
# sources: ['ubuntu-toolchain-r-test']
# packages: ['g++-4.9', 'valgrind', 'python-pip', 'python-yaml']
# before_script:
# - pip install --user git+git://github.com/eddyxu/cpp-coveralls.git
# after_success:
# - make clean
# - touch src/json.hpp
# - make json_unit CXXFLAGS="-fprofile-arcs -ftest-coverage -std=c++11 -lstdc++" CXX=$COMPILER
# - test/json_unit "*"
# - coveralls --build-root test --exclude src/catch.hpp --exclude src/unit-algorithms.cpp --exclude src/unit-allocator.cpp --exclude src/unit-capacity.cpp --exclude src/unit-class_const_iterator.cpp --exclude src/unit-class_iterator.cpp --exclude src/unit-class_lexer.cpp --exclude src/unit-class_parser.cpp --exclude src/unit-comparison.cpp --exclude src/unit-concepts.cpp --exclude src/unit-constructor1.cpp --exclude src/unit-constructor2.cpp --exclude src/unit-convenience.cpp --exclude src/unit-conversions.cpp --exclude src/unit-deserialization.cpp --exclude src/unit-element_access1.cpp --exclude src/unit-element_access2.cpp --exclude src/unit-inspection.cpp --exclude src/unit-iterator_wrapper.cpp --exclude src/unit-iterators1.cpp --exclude src/unit-iterators2.cpp --exclude src/unit-json_patch.cpp --exclude src/unit-json_pointer.cpp --exclude src/unit-modifiers.cpp --exclude src/unit-pointer_access.cpp --exclude src/unit-readme.cpp --exclude src/unit-reference_access.cpp --exclude src/unit-regression.cpp --exclude src/unit-serialization.cpp --exclude src/unit-testsuites.cpp --exclude src/unit-unicode.cpp --include ../src/json.hpp --gcov-options '\-lp' --gcov 'gcov-4.9'
# env: COMPILER=g++-4.9
#
# - os: linux
# compiler: gcc
# before_install: echo -n | openssl s_client -connect scan.coverity.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | sudo tee -a /etc/ssl/certs/ca-certificates.crt
# addons:
# apt:
# sources: ['ubuntu-toolchain-r-test']
# packages: ['g++-5', 'valgrind']
# coverity_scan:
# project:
# name: "nlohmann/json"
# description: "Build submitted via Travis CI"
# notification_email: niels.lohmann@gmail.com
# build_command_prepend: "make clean ; sudo cp $(which g++-5) $(which g++)"
# build_command: "make"
# branch_pattern: coverity_scan
# env: COMPILER=g++-5
#

View File

@@ -1,55 +1,98 @@
cmake_minimum_required(VERSION 3.0)
cmake_minimum_required(VERSION 3.0.0)
# define the project
project(nlohmann_json VERSION 2.0.7 LANGUAGES CXX)
##
## PROJECT
## name and version
##
project(nlohmann_json VERSION 3.0.0 LANGUAGES CXX)
enable_testing()
##
## OPTIONS
##
option(JSON_BuildTests "Build the unit tests" ON)
option(BuildTests "Build the unit tests" ON)
##
## CONFIGURATION
##
set(NLOHMANN_JSON_TARGET_NAME ${PROJECT_NAME})
set(NLOHMANN_JSON_SOURCE_DIR "src/")
set(NLOHMANN_JSON_CONFIG_INSTALL_DIR "lib/cmake/${PROJECT_NAME}")
set(NLOHMANN_JSON_INCLUDE_INSTALL_DIR "include")
set(NLOHMANN_JSON_HEADER_INSTALL_DIR "${NLOHMANN_JSON_INCLUDE_INSTALL_DIR}/nlohmann")
set(NLOHMANN_JSON_TARGETS_EXPORT_NAME "${PROJECT_NAME}Targets")
set(NLOHMANN_JSON_CMAKE_CONFIG_TEMPLATE "cmake/config.cmake.in")
set(NLOHMANN_JSON_CMAKE_CONFIG_DIR "${CMAKE_CURRENT_BINARY_DIR}/cmake_config")
set(NLOHMANN_JSON_CMAKE_VERSION_CONFIG_FILE "${NLOHMANN_JSON_CMAKE_CONFIG_DIR}/${PROJECT_NAME}ConfigVersion.cmake")
set(NLOHMANN_JSON_CMAKE_PROJECT_CONFIG_FILE "${NLOHMANN_JSON_CMAKE_CONFIG_DIR}/${PROJECT_NAME}Config.cmake")
# define project variables
set(JSON_TARGET_NAME ${PROJECT_NAME})
set(JSON_PACKAGE_NAME ${JSON_TARGET_NAME})
set(JSON_TARGETS_FILENAME "${JSON_PACKAGE_NAME}Targets.cmake")
set(JSON_CONFIG_FILENAME "${JSON_PACKAGE_NAME}Config.cmake")
set(JSON_CONFIGVERSION_FILENAME "${JSON_PACKAGE_NAME}ConfigVersion.cmake")
set(JSON_CONFIG_DESTINATION "cmake")
set(JSON_INCLUDE_DESTINATION "include/nlohmann")
##
## TARGET
## create target and add include path
##
add_library(${NLOHMANN_JSON_TARGET_NAME} INTERFACE)
# create and configure the library target
add_library(${JSON_TARGET_NAME} INTERFACE)
target_include_directories(${JSON_TARGET_NAME} INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
$<INSTALL_INTERFACE:${JSON_INCLUDE_DESTINATION}>)
target_include_directories(
${NLOHMANN_JSON_TARGET_NAME}
INTERFACE
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/src>
$<INSTALL_INTERFACE:include>
)
# create and configure the unit test target
if (BuildTests)
## add debug view defintion file for msvc (natvis) [cmake <= 3.2.2 does not support export of source files]
if (MSVC AND CMAKE_VERSION VERSION_GREATER "3.2.2")
set(NLOHMANN_ADD_NATVIS TRUE)
set(NLOHMANN_NATVIS_FILE "nlohmann_json.natvis")
target_sources(
${NLOHMANN_JSON_TARGET_NAME}
INTERFACE
$<INSTALL_INTERFACE:${NLOHMANN_NATVIS_FILE}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/${NLOHMANN_NATVIS_FILE}>
)
endif()
##
## TESTS
## create and configure the unit test target
##
if(JSON_BuildTests)
enable_testing()
include_directories(${NLOHMANN_JSON_SOURCE_DIR})
add_subdirectory(test)
endif()
# generate a config and config version file for the package
##
## INSTALL
## install header files, generate and install cmake config files for find_package()
##
include(CMakePackageConfigHelpers)
configure_package_config_file("cmake/config.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/${JSON_CONFIG_FILENAME}"
INSTALL_DESTINATION ${JSON_CONFIG_DESTINATION}
PATH_VARS JSON_INCLUDE_DESTINATION)
write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/${JSON_CONFIGVERSION_FILENAME}"
VERSION ${PROJECT_VERSION}
COMPATIBILITY SameMajorVersion)
# export the library target and store build directory in package registry
export(TARGETS ${JSON_TARGET_NAME}
FILE "${CMAKE_CURRENT_BINARY_DIR}/${JSON_TARGETS_FILENAME}")
export(PACKAGE ${JSON_PACKAGE_NAME})
# install library target and config files
install(TARGETS ${JSON_TARGET_NAME}
EXPORT ${JSON_PACKAGE_NAME})
install(FILES "src/json.hpp"
DESTINATION ${JSON_INCLUDE_DESTINATION})
install(EXPORT ${JSON_PACKAGE_NAME}
FILE ${JSON_TARGETS_FILENAME}
DESTINATION ${JSON_CONFIG_DESTINATION})
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${JSON_CONFIG_FILENAME}"
"${CMAKE_CURRENT_BINARY_DIR}/${JSON_CONFIGVERSION_FILENAME}"
DESTINATION ${JSON_CONFIG_DESTINATION})
write_basic_package_version_file(
${NLOHMANN_JSON_CMAKE_VERSION_CONFIG_FILE} COMPATIBILITY SameMajorVersion
)
configure_package_config_file(
${NLOHMANN_JSON_CMAKE_CONFIG_TEMPLATE}
${NLOHMANN_JSON_CMAKE_PROJECT_CONFIG_FILE}
INSTALL_DESTINATION ${NLOHMANN_JSON_CONFIG_INSTALL_DIR}
)
install(
DIRECTORY ${NLOHMANN_JSON_SOURCE_DIR}
DESTINATION ${NLOHMANN_JSON_HEADER_INSTALL_DIR}
)
install(
FILES ${NLOHMANN_JSON_CMAKE_PROJECT_CONFIG_FILE} ${NLOHMANN_JSON_CMAKE_VERSION_CONFIG_FILE}
DESTINATION ${NLOHMANN_JSON_CONFIG_INSTALL_DIR}
)
if (NLOHMANN_ADD_NATVIS)
install(
FILES ${NLOHMANN_NATVIS_FILE}
DESTINATION .
)
endif()
install(
TARGETS ${NLOHMANN_JSON_TARGET_NAME}
EXPORT ${NLOHMANN_JSON_TARGETS_EXPORT_NAME}
INCLUDES DESTINATION ${NLOHMANN_JSON_INCLUDE_INSTALL_DIR}
)
install(
EXPORT ${NLOHMANN_JSON_TARGETS_EXPORT_NAME}
DESTINATION ${NLOHMANN_JSON_CONFIG_INSTALL_DIR}
)

46
CODE_OF_CONDUCT.md Normal file
View File

@@ -0,0 +1,46 @@
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at mail@nlohmann.me. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/

View File

@@ -1,24 +1,579 @@
# Change Log
All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/).
## [v3.0.0](https://github.com/nlohmann/json/releases/tag/v3.0.0) (2017-12-17)
[Full Changelog](https://github.com/nlohmann/json/compare/v2.1.1...v3.0.0)
- unicode strings [\#878](https://github.com/nlohmann/json/issues/878)
- Visual Studio 2017 15.5 C++17 std::allocator deprecations [\#872](https://github.com/nlohmann/json/issues/872)
- Typo "excpetion" [\#869](https://github.com/nlohmann/json/issues/869)
- Explicit array example in README.md incorrect [\#867](https://github.com/nlohmann/json/issues/867)
- why don't you release this from Feb. ? [\#865](https://github.com/nlohmann/json/issues/865)
- json::parse throws std::invalid\_argument when processing string generated by json::dump\(\) [\#863](https://github.com/nlohmann/json/issues/863)
- code analysis: potential bug? [\#859](https://github.com/nlohmann/json/issues/859)
- MSVC2017, 15.5 new issues. [\#857](https://github.com/nlohmann/json/issues/857)
- very basic: fetching string value/content without quotes [\#853](https://github.com/nlohmann/json/issues/853)
- Ambiguous function call to get with pointer type and constant json object in VS2015 \(15.4.4\) [\#852](https://github.com/nlohmann/json/issues/852)
- How to put object in the array as a member? [\#850](https://github.com/nlohmann/json/issues/850)
- misclick, please ignore [\#849](https://github.com/nlohmann/json/issues/849)
- Make XML great again. [\#847](https://github.com/nlohmann/json/issues/847)
- Converting to array not working [\#843](https://github.com/nlohmann/json/issues/843)
- Iteration weirdness [\#842](https://github.com/nlohmann/json/issues/842)
- Use reference or pointer as Object value [\#841](https://github.com/nlohmann/json/issues/841)
- Ambiguity in parsing nested maps [\#840](https://github.com/nlohmann/json/issues/840)
- could not find from\_json\(\) method in T's namespace [\#839](https://github.com/nlohmann/json/issues/839)
- Incorrect parse error with binary data in keys? [\#838](https://github.com/nlohmann/json/issues/838)
- using dump\(\) when std::wstring is StringType with VS2017 [\#836](https://github.com/nlohmann/json/issues/836)
- Show the path of the currently parsed value when an error occurs [\#835](https://github.com/nlohmann/json/issues/835)
- Repetitive data type while reading [\#833](https://github.com/nlohmann/json/issues/833)
- Stack-overflow \(OSS-Fuzz 4234\) [\#832](https://github.com/nlohmann/json/issues/832)
- Storing multiple types inside map [\#831](https://github.com/nlohmann/json/issues/831)
- Application terminating [\#830](https://github.com/nlohmann/json/issues/830)
- Missing CMake hunter package? [\#828](https://github.com/nlohmann/json/issues/828)
- std::map\<std::string, std::string\> from json object yields C2665: 'std::pair\<const \_Kty,\_Ty\>::pair': none of the 2 overloads could convert all the argument types [\#827](https://github.com/nlohmann/json/issues/827)
- object.dump gives quoted string, want to use .dump\(\) to generate javascripts. [\#826](https://github.com/nlohmann/json/issues/826)
- Assertion failed on \["NoExistKey"\] of an not existing key of const json& [\#825](https://github.com/nlohmann/json/issues/825)
- vs2015 error : static member will remain uninitialized at runtime but use in constant-expressions is supported [\#824](https://github.com/nlohmann/json/issues/824)
- Code Checking Warnings from json.hpp on VS2017 Community [\#821](https://github.com/nlohmann/json/issues/821)
- Missing iostream in try online [\#820](https://github.com/nlohmann/json/issues/820)
- Floating point value loses decimal point during dump [\#818](https://github.com/nlohmann/json/issues/818)
- Conan package for the library [\#817](https://github.com/nlohmann/json/issues/817)
- stream error [\#815](https://github.com/nlohmann/json/issues/815)
- Link error when using find\(\) on the latest commit [\#814](https://github.com/nlohmann/json/issues/814)
- ABI issue with json object between 2 shared libraries [\#813](https://github.com/nlohmann/json/issues/813)
- scan\_string\(\) return token\_type::parse\_error; when parse ansi file [\#812](https://github.com/nlohmann/json/issues/812)
- segfault when using fifo\_map with json [\#810](https://github.com/nlohmann/json/issues/810)
- This shit is shit [\#809](https://github.com/nlohmann/json/issues/809)
- \_finite and \_isnan are no members of "std" [\#808](https://github.com/nlohmann/json/issues/808)
- how to print out the line which causing exception? [\#806](https://github.com/nlohmann/json/issues/806)
- {} uses copy constructor, while = does not [\#805](https://github.com/nlohmann/json/issues/805)
- json.hpp:8955: multiple definition of function that is not defined twice or more. [\#804](https://github.com/nlohmann/json/issues/804)
- \[question\] to\_json for base and derived class [\#803](https://github.com/nlohmann/json/issues/803)
- Misleading error message - unexpected '"' - on incorrect utf-8 symbol [\#802](https://github.com/nlohmann/json/issues/802)
- json data = std::string\_view\("hi"\); doesn't work? [\#801](https://github.com/nlohmann/json/issues/801)
- Thread safety of parse\(\) [\#800](https://github.com/nlohmann/json/issues/800)
- Numbers as strings [\#799](https://github.com/nlohmann/json/issues/799)
- Tests failing on arm [\#797](https://github.com/nlohmann/json/issues/797)
- Using your library \(without modification\) in another library [\#796](https://github.com/nlohmann/json/issues/796)
- Iterating over sub-object [\#794](https://github.com/nlohmann/json/issues/794)
- how to get the json object again from which printed by the method of dump\(\) [\#792](https://github.com/nlohmann/json/issues/792)
- ppa to include source [\#791](https://github.com/nlohmann/json/issues/791)
- Different include paths in macOS and Ubuntu [\#790](https://github.com/nlohmann/json/issues/790)
- Missing break after line 12886 in switch/case [\#789](https://github.com/nlohmann/json/issues/789)
- All unit tests fail? [\#787](https://github.com/nlohmann/json/issues/787)
- More use of move semantics in deserialization [\#786](https://github.com/nlohmann/json/issues/786)
- warning C4706 - Visual Studio 2017 \(/W4\) [\#784](https://github.com/nlohmann/json/issues/784)
- Compile error in clang 5.0 [\#782](https://github.com/nlohmann/json/issues/782)
- Error Installing appium\_lib with Ruby v2.4.2 Due to JSON [\#781](https://github.com/nlohmann/json/issues/781)
- ::get\<int\>\(\) fails in new\(er\) release \[MSVC\] [\#780](https://github.com/nlohmann/json/issues/780)
- Type Conversion [\#779](https://github.com/nlohmann/json/issues/779)
- Segfault on nested parsing [\#778](https://github.com/nlohmann/json/issues/778)
- Build warnings: shadowing exception id [\#776](https://github.com/nlohmann/json/issues/776)
- multi-level JSON support. [\#775](https://github.com/nlohmann/json/issues/775)
- SIGABRT on dump\(\) [\#773](https://github.com/nlohmann/json/issues/773)
- \[Question\] Custom StringType template parameter \(possibility for a KeyType template parameter\) [\#772](https://github.com/nlohmann/json/issues/772)
- constexpr ALL the Things! [\#771](https://github.com/nlohmann/json/issues/771)
- error: BasicJsonType in namespace :: does not name a type [\#770](https://github.com/nlohmann/json/issues/770)
- Program calls abort function [\#769](https://github.com/nlohmann/json/issues/769)
- \[Question\] Floating point resolution config during dump\(\) ? [\#768](https://github.com/nlohmann/json/issues/768)
- make check - no test ran [\#767](https://github.com/nlohmann/json/issues/767)
- The library cannot work properly with custom allocator based containers [\#766](https://github.com/nlohmann/json/issues/766)
- Documentation or feature request. [\#763](https://github.com/nlohmann/json/issues/763)
- warnings in msvc about mix/max macro while windows.h is used in the project [\#762](https://github.com/nlohmann/json/issues/762)
- std::signbit ambiguous [\#761](https://github.com/nlohmann/json/issues/761)
- How to use value for std::experimental::optional type? [\#760](https://github.com/nlohmann/json/issues/760)
- Cannot load json file properly [\#759](https://github.com/nlohmann/json/issues/759)
- Compilation error with unordered\_map\< int, int \> [\#758](https://github.com/nlohmann/json/issues/758)
- CBOR string [\#757](https://github.com/nlohmann/json/issues/757)
- Proposal: out\_of\_range should be a subclass of std::out\_of\_range [\#756](https://github.com/nlohmann/json/issues/756)
- Compiling with icpc [\#755](https://github.com/nlohmann/json/issues/755)
- Getter is setting the value to null if the key does not exist [\#754](https://github.com/nlohmann/json/issues/754)
- parsing works sometimes and crashes others [\#752](https://github.com/nlohmann/json/issues/752)
- Static\_assert failed "incompatible pointer type" with Xcode [\#751](https://github.com/nlohmann/json/issues/751)
- user-defined literal operator not found [\#750](https://github.com/nlohmann/json/issues/750)
- getting clean string from it.key\(\) [\#748](https://github.com/nlohmann/json/issues/748)
- Best method for exploring and obtaining values of nested json objects when the names are not known beforehand? [\#747](https://github.com/nlohmann/json/issues/747)
- null char at the end of string [\#746](https://github.com/nlohmann/json/issues/746)
- Incorrect sample for operator \>\> in docs [\#745](https://github.com/nlohmann/json/issues/745)
- User-friendly documentation [\#744](https://github.com/nlohmann/json/issues/744)
- Retrieve all values that match a json path [\#743](https://github.com/nlohmann/json/issues/743)
- Compilation issue with gcc 7.2 [\#742](https://github.com/nlohmann/json/issues/742)
- CMake target nlohmann\_json does not have src into its interface includes [\#741](https://github.com/nlohmann/json/issues/741)
- Error when serializing empty json: type must be string, but is object [\#740](https://github.com/nlohmann/json/issues/740)
- Conversion error for std::map\<int, std::string\> [\#739](https://github.com/nlohmann/json/issues/739)
- Dumping Json to file as array [\#738](https://github.com/nlohmann/json/issues/738)
- nesting json objects [\#737](https://github.com/nlohmann/json/issues/737)
- where to find general help? [\#736](https://github.com/nlohmann/json/issues/736)
- Compilation Error on Clang 5.0 Upgrade [\#735](https://github.com/nlohmann/json/issues/735)
- Compilation error with std::map\<std::string, std::string\> on vs 2015 [\#734](https://github.com/nlohmann/json/issues/734)
- Benchmarks for Binary formats [\#733](https://github.com/nlohmann/json/issues/733)
- Move test blobs to a submodule? [\#732](https://github.com/nlohmann/json/issues/732)
- Support \n symbols in json string. [\#731](https://github.com/nlohmann/json/issues/731)
- Project's name is too generic and hard to search for [\#730](https://github.com/nlohmann/json/issues/730)
- Visual Studio 2015 IntelliTrace problems [\#729](https://github.com/nlohmann/json/issues/729)
- How to erase nested objects inside other objects? [\#728](https://github.com/nlohmann/json/issues/728)
- How to prevent alphabetical sorting of data? [\#727](https://github.com/nlohmann/json/issues/727)
- Serialization for CBOR [\#726](https://github.com/nlohmann/json/issues/726)
- Using json Object as value in a map [\#725](https://github.com/nlohmann/json/issues/725)
- std::regex and nlohmann::json value [\#724](https://github.com/nlohmann/json/issues/724)
- Warnings when compiling with VisualStudio 2015 [\#723](https://github.com/nlohmann/json/issues/723)
- Has this lib the unicode \(wstring\) support? [\#722](https://github.com/nlohmann/json/issues/722)
- When will be 3.0 in master? [\#721](https://github.com/nlohmann/json/issues/721)
- Determine the type from error message. [\#720](https://github.com/nlohmann/json/issues/720)
- Compile-Error C2100 \(MS VS2015\) in line 887 json.hpp [\#719](https://github.com/nlohmann/json/issues/719)
- from\_json not working for boost::optional example [\#718](https://github.com/nlohmann/json/issues/718)
- about from\_json and to\_json function [\#717](https://github.com/nlohmann/json/issues/717)
- How to deserialize array with derived objects [\#716](https://github.com/nlohmann/json/issues/716)
- How to detect parse failure? [\#715](https://github.com/nlohmann/json/issues/715)
- Parse throw std::ios\_base::failure exception when failbit set to true [\#714](https://github.com/nlohmann/json/issues/714)
- Is there a way of format just making a pretty print without changing the key's orders ? [\#713](https://github.com/nlohmann/json/issues/713)
- Serialization of array of not same model items [\#712](https://github.com/nlohmann/json/issues/712)
- pointer to json parse vector [\#711](https://github.com/nlohmann/json/issues/711)
- Gtest SEH Exception [\#709](https://github.com/nlohmann/json/issues/709)
- broken from\_json implementation for pair and tuple [\#707](https://github.com/nlohmann/json/issues/707)
- Unevaluated lambda in assert breaks gcc 7 build [\#705](https://github.com/nlohmann/json/issues/705)
- Issues when adding values to firebase database [\#704](https://github.com/nlohmann/json/issues/704)
- Floating point equality - revisited [\#703](https://github.com/nlohmann/json/issues/703)
- Conversion from valarray\<double\> to json fails to build [\#702](https://github.com/nlohmann/json/issues/702)
- internal compiler error \(gcc7\) [\#701](https://github.com/nlohmann/json/issues/701)
- One build system to rule them all [\#698](https://github.com/nlohmann/json/issues/698)
- Generated nlohmann\_jsonConfig.cmake does not set JSON\_INCLUDE\_DIR [\#695](https://github.com/nlohmann/json/issues/695)
- support the Chinese language in json string [\#694](https://github.com/nlohmann/json/issues/694)
- NaN problem within develop branch [\#693](https://github.com/nlohmann/json/issues/693)
- Please post example of specialization for boost::filesystem [\#692](https://github.com/nlohmann/json/issues/692)
- Impossible to do an array of composite objects [\#691](https://github.com/nlohmann/json/issues/691)
- How to save json to file? [\#690](https://github.com/nlohmann/json/issues/690)
- my simple json parser [\#689](https://github.com/nlohmann/json/issues/689)
- problem with new struct parsing syntax [\#688](https://github.com/nlohmann/json/issues/688)
- Parse error while parse the json string contains UTF 8 encoded document bytes string [\#684](https://github.com/nlohmann/json/issues/684)
- \[question\] how to get a string value by pointer [\#683](https://github.com/nlohmann/json/issues/683)
- create json object from string variable [\#681](https://github.com/nlohmann/json/issues/681)
- adl\_serializer and CRTP [\#680](https://github.com/nlohmann/json/issues/680)
- Is there a way to control the precision of serialized floating point numbers? [\#677](https://github.com/nlohmann/json/issues/677)
- Is there a way to get the path of a value? [\#676](https://github.com/nlohmann/json/issues/676)
- Could the parser locate errors to line? [\#675](https://github.com/nlohmann/json/issues/675)
- There is performance inefficiency found by coverity tool json2.1.1/include/nlohmann/json.hpp [\#673](https://github.com/nlohmann/json/issues/673)
- include problem, when cmake on osx [\#672](https://github.com/nlohmann/json/issues/672)
- Operator= ambiguous in C++1z and GCC 7.1.1 [\#670](https://github.com/nlohmann/json/issues/670)
- should't the cmake install target be to nlohman/json.hpp [\#668](https://github.com/nlohmann/json/issues/668)
- deserialise from `std::vector` [\#667](https://github.com/nlohmann/json/issues/667)
- How to iterate? [\#665](https://github.com/nlohmann/json/issues/665)
- could this json lib work on windows? [\#664](https://github.com/nlohmann/json/issues/664)
- How does from\_json work? [\#662](https://github.com/nlohmann/json/issues/662)
- insert\(or merge\) object should replace same key , not ignore [\#661](https://github.com/nlohmann/json/issues/661)
- Why is an object ordering values by Alphabetical Order? [\#660](https://github.com/nlohmann/json/issues/660)
- Parse method doesn't handle newlines. [\#659](https://github.com/nlohmann/json/issues/659)
- Compilation "note" on GCC 6 ARM [\#658](https://github.com/nlohmann/json/issues/658)
- Adding additional push\_back/operator+= rvalue overloads for JSON object [\#657](https://github.com/nlohmann/json/issues/657)
- dump's parameter "ensure\_ascii" creates too long sequences [\#656](https://github.com/nlohmann/json/issues/656)
- Question: parsing `void \*` [\#655](https://github.com/nlohmann/json/issues/655)
- how should I check a string is valid JSON string ? [\#653](https://github.com/nlohmann/json/issues/653)
- Question: thread safety of read only accesses [\#651](https://github.com/nlohmann/json/issues/651)
- Eclipse: Method 'size' could not be resolved [\#649](https://github.com/nlohmann/json/issues/649)
- Update/Add object fields [\#648](https://github.com/nlohmann/json/issues/648)
- No exception raised for Out Of Range input of numbers [\#647](https://github.com/nlohmann/json/issues/647)
- Package Name [\#646](https://github.com/nlohmann/json/issues/646)
- What is the meaning of operator\[\]\(T\* key\) [\#645](https://github.com/nlohmann/json/issues/645)
- Which is the correct way to json objects as parameters to functions? [\#644](https://github.com/nlohmann/json/issues/644)
- Method to get string representations of values [\#642](https://github.com/nlohmann/json/issues/642)
- CBOR serialization of a given JSON value does not serialize [\#641](https://github.com/nlohmann/json/issues/641)
- Are we forced to use "-fexceptions" flag in android ndk project [\#640](https://github.com/nlohmann/json/issues/640)
- Comparison of objects containing floats [\#639](https://github.com/nlohmann/json/issues/639)
- 'localeconv' is not supported by NDK for SDK \<=20 [\#638](https://github.com/nlohmann/json/issues/638)
- \[Question\] cLion integration [\#637](https://github.com/nlohmann/json/issues/637)
- How to construct an iteratable usage in nlohmann json? [\#636](https://github.com/nlohmann/json/issues/636)
- \[Question\] copy assign json-container to vector [\#635](https://github.com/nlohmann/json/issues/635)
- Get size without .dump\(\) [\#634](https://github.com/nlohmann/json/issues/634)
- Segmentation fault when parsing invalid json file [\#633](https://github.com/nlohmann/json/issues/633)
- How to serialize from json to vector\<customType\>? [\#632](https://github.com/nlohmann/json/issues/632)
- no member named 'thousands\_sep' in 'lconv' [\#631](https://github.com/nlohmann/json/issues/631)
- \[Question\] Any fork for \(the unsupported\) Visual Studio 2012 version? [\#628](https://github.com/nlohmann/json/issues/628)
- Dependency injection in serializer [\#627](https://github.com/nlohmann/json/issues/627)
- from\_json for std::array [\#625](https://github.com/nlohmann/json/issues/625)
- Discussion: How to structure the parsing function families [\#623](https://github.com/nlohmann/json/issues/623)
- Question: How to erase subtree [\#622](https://github.com/nlohmann/json/issues/622)
- Insertion into nested json field [\#621](https://github.com/nlohmann/json/issues/621)
- \[Question\] When using this as git submodule, will it clone the whole thing include test data and benchmark? [\#620](https://github.com/nlohmann/json/issues/620)
- Question: return static json object from function [\#618](https://github.com/nlohmann/json/issues/618)
- icc16 error [\#617](https://github.com/nlohmann/json/issues/617)
- \[-Wdeprecated-declarations\] in row `j \>\> ss;` in file `json.hpp:7405:26` and FAILED unit tests with MinGWx64! [\#616](https://github.com/nlohmann/json/issues/616)
- to\_json for pairs, tuples [\#614](https://github.com/nlohmann/json/issues/614)
- Using uninitialized memory 'buf' in line 11173 v2.1.1? [\#613](https://github.com/nlohmann/json/issues/613)
- How to parse multiple same Keys of JSON and save them? [\#612](https://github.com/nlohmann/json/issues/612)
- "Multiple declarations" error when using types defined with `typedef` [\#611](https://github.com/nlohmann/json/issues/611)
- 2.1.1+ breaks compilation of shared\_ptr\<json\> == 0 [\#610](https://github.com/nlohmann/json/issues/610)
- a bug of inheritance ? [\#608](https://github.com/nlohmann/json/issues/608)
- std::map key conversion with to\_json [\#607](https://github.com/nlohmann/json/issues/607)
- json.hpp:6384:62: error: wrong number of template arguments \(1, should be 2\) [\#606](https://github.com/nlohmann/json/issues/606)
- Incremental parsing: Where's the push version? [\#605](https://github.com/nlohmann/json/issues/605)
- Is there a way to validate the structure of a json object ? [\#604](https://github.com/nlohmann/json/issues/604)
- \[Question\] Issue when using Appveyor when compiling library [\#603](https://github.com/nlohmann/json/issues/603)
- BOM not skipped when using json:parse\(iterator\) [\#602](https://github.com/nlohmann/json/issues/602)
- Use of the binary type in CBOR and Message Pack [\#601](https://github.com/nlohmann/json/issues/601)
- Newbie issue: how does one convert a map in Json back to std::map? [\#600](https://github.com/nlohmann/json/issues/600)
- Plugin system [\#599](https://github.com/nlohmann/json/issues/599)
- Feature request: Comments [\#597](https://github.com/nlohmann/json/issues/597)
- Using custom types for scalars? [\#596](https://github.com/nlohmann/json/issues/596)
- Issues with the arithmetic in iterator and reverse iterator [\#593](https://github.com/nlohmann/json/issues/593)
- not enough examples [\#592](https://github.com/nlohmann/json/issues/592)
- in-class initialization for type 'const T' is not yet implemented [\#591](https://github.com/nlohmann/json/issues/591)
- compiling with gcc 7 -\> error on bool operator \< [\#590](https://github.com/nlohmann/json/issues/590)
- Parsing from stream leads to an array [\#589](https://github.com/nlohmann/json/issues/589)
- Buggy support for binary string data [\#587](https://github.com/nlohmann/json/issues/587)
- C++17's ambiguous conversion [\#586](https://github.com/nlohmann/json/issues/586)
- How does the messagepack encoding/decoding compare to msgpack-cpp in terms of performance? [\#585](https://github.com/nlohmann/json/issues/585)
- is it possible to check existence of a value deep in hierarchy? [\#584](https://github.com/nlohmann/json/issues/584)
- loading from a stream and exceptions [\#582](https://github.com/nlohmann/json/issues/582)
- Visual Studio seems not to have all min\(\) function versions [\#581](https://github.com/nlohmann/json/issues/581)
- Supporting of the json schema [\#580](https://github.com/nlohmann/json/issues/580)
- Stack-overflow \(OSS-Fuzz 1444\) [\#577](https://github.com/nlohmann/json/issues/577)
- Heap-buffer-overflow \(OSS-Fuzz 1400\) [\#575](https://github.com/nlohmann/json/issues/575)
- JSON escape quotes [\#574](https://github.com/nlohmann/json/issues/574)
- error: static\_assert failed [\#573](https://github.com/nlohmann/json/issues/573)
- Storing floats, and round trip serialisation/deserialisation diffs [\#572](https://github.com/nlohmann/json/issues/572)
- JSON.getLong produces inconsistent results [\#571](https://github.com/nlohmann/json/issues/571)
- Request: Object.at\(\) with default return value [\#570](https://github.com/nlohmann/json/issues/570)
- Internal structure gets corrupted while parsing [\#569](https://github.com/nlohmann/json/issues/569)
- create template \<typename Iter\> basic\_json from\_cbor\(Iter begin, Iter end\) [\#568](https://github.com/nlohmann/json/issues/568)
- Need to improve ignores.. [\#567](https://github.com/nlohmann/json/issues/567)
- Conan.io [\#566](https://github.com/nlohmann/json/issues/566)
- contradictory documentation regarding json::find [\#565](https://github.com/nlohmann/json/issues/565)
- Unexpected '\"' in middle of array [\#564](https://github.com/nlohmann/json/issues/564)
- Support parse std::pair to Json object [\#563](https://github.com/nlohmann/json/issues/563)
- json and Microsoft Visual c++ Compiler Nov 2012 CTP [\#562](https://github.com/nlohmann/json/issues/562)
- from\_json declaration order and exceptions [\#561](https://github.com/nlohmann/json/issues/561)
- Tip: Don't upgrade to VS2017 if using json initializer list constructs [\#559](https://github.com/nlohmann/json/issues/559)
- parse error - unexpected end of input [\#558](https://github.com/nlohmann/json/issues/558)
- Cant modify existing numbers inside a json object [\#557](https://github.com/nlohmann/json/issues/557)
- Minimal repository \(current size very large\) [\#556](https://github.com/nlohmann/json/issues/556)
- Better support for SAX style serialize and deserialize in new version? [\#554](https://github.com/nlohmann/json/issues/554)
- Cannot convert from json array to std::array [\#553](https://github.com/nlohmann/json/issues/553)
- Do not define an unnamed namespace in a header file \(DCL59-CPP\) [\#552](https://github.com/nlohmann/json/issues/552)
- Parse error on known good json file [\#551](https://github.com/nlohmann/json/issues/551)
- Warning on Intel compiler \(icc 17\) [\#550](https://github.com/nlohmann/json/issues/550)
- multiple versions of 'vsnprintf' [\#549](https://github.com/nlohmann/json/issues/549)
- illegal indirection [\#548](https://github.com/nlohmann/json/issues/548)
- Ambiguous compare operators with clang-5.0 [\#547](https://github.com/nlohmann/json/issues/547)
- Using tsl::ordered\_map [\#546](https://github.com/nlohmann/json/issues/546)
- Compiler support errors are inconvenient [\#544](https://github.com/nlohmann/json/issues/544)
- Head Elements Sorting [\#543](https://github.com/nlohmann/json/issues/543)
- Duplicate symbols error happens while to\_json/from\_json method implemented inside entity definition header file [\#542](https://github.com/nlohmann/json/issues/542)
- consider adding a bool json::is\_valid\(std::string const&\) non-member function [\#541](https://github.com/nlohmann/json/issues/541)
- Help request [\#539](https://github.com/nlohmann/json/issues/539)
- How to deal with missing keys in `from\_json`? [\#538](https://github.com/nlohmann/json/issues/538)
- recursive from\_msgpack implementation will stack overflow [\#537](https://github.com/nlohmann/json/issues/537)
- Exception objects must be nothrow copy constructible \(ERR60-CPP\) [\#531](https://github.com/nlohmann/json/issues/531)
- Support for multiple root elements [\#529](https://github.com/nlohmann/json/issues/529)
- Port has\_shape from dropbox/json11 [\#528](https://github.com/nlohmann/json/issues/528)
- dump\_float: truncation from ptrdiff\_t to long [\#527](https://github.com/nlohmann/json/issues/527)
- Make exception base class visible in basic\_json [\#525](https://github.com/nlohmann/json/issues/525)
- msgpack unit test failures on ppc64 arch [\#524](https://github.com/nlohmann/json/issues/524)
- How about split the implementation out, and only leave the interface? [\#523](https://github.com/nlohmann/json/issues/523)
- VC++2017 not enough actual parameters for macro 'max' [\#522](https://github.com/nlohmann/json/issues/522)
- crash on empty ifstream [\#521](https://github.com/nlohmann/json/issues/521)
- Suggestion: Support tabs for indentation when serializing to stream. [\#520](https://github.com/nlohmann/json/issues/520)
- Abrt in get\_number \(OSS-Fuzz 885\) [\#519](https://github.com/nlohmann/json/issues/519)
- Abrt on unknown address \(OSS-Fuzz 884\) [\#518](https://github.com/nlohmann/json/issues/518)
- Stack-overflow \(OSS-Fuzz 869\) [\#517](https://github.com/nlohmann/json/issues/517)
- Assertion error \(OSS-Fuzz 868\) [\#516](https://github.com/nlohmann/json/issues/516)
- NaN to json and back [\#515](https://github.com/nlohmann/json/issues/515)
- Comparison of NaN [\#514](https://github.com/nlohmann/json/issues/514)
- why it's not possible to serialize c++11 enums directly [\#513](https://github.com/nlohmann/json/issues/513)
- clang compile error: use of overloaded operator '\<=' is ambiguous with \(nlohmann::json{{"a", 5}}\)\["a"\] \<= 10 [\#512](https://github.com/nlohmann/json/issues/512)
- Why not also look inside the type for \(static\) to\_json and from\_json funtions? [\#511](https://github.com/nlohmann/json/issues/511)
- Parser issues [\#509](https://github.com/nlohmann/json/issues/509)
- I may not understand [\#507](https://github.com/nlohmann/json/issues/507)
- VS2017 min / max problem for 2.1.1 [\#506](https://github.com/nlohmann/json/issues/506)
- CBOR/MessagePack is not read until the end [\#505](https://github.com/nlohmann/json/issues/505)
- Assertion error \(OSS-Fuzz 856\) [\#504](https://github.com/nlohmann/json/issues/504)
- Return position in parse error exceptions [\#503](https://github.com/nlohmann/json/issues/503)
- conversion from/to C array is not supported [\#502](https://github.com/nlohmann/json/issues/502)
- error C2338: could not find to\_json\(\) method in T's namespace [\#501](https://github.com/nlohmann/json/issues/501)
- Test suite fails in en\_GB.UTF-8 [\#500](https://github.com/nlohmann/json/issues/500)
- cannot use operator\[\] with number [\#499](https://github.com/nlohmann/json/issues/499)
- consider using \_\_cpp\_exceptions and/or \_\_EXCEPTIONS to disable/enable exception support [\#498](https://github.com/nlohmann/json/issues/498)
- Stack-overflow \(OSS-Fuzz issue 814\) [\#497](https://github.com/nlohmann/json/issues/497)
- Using in Unreal Engine - handling custom types conversion [\#495](https://github.com/nlohmann/json/issues/495)
- Conversion from vector\<bool\> to json fails to build [\#494](https://github.com/nlohmann/json/issues/494)
- fill\_line\_buffer incorrectly tests m\_stream for eof but not fail or bad bits [\#493](https://github.com/nlohmann/json/issues/493)
- Compiling with \_GLIBCXX\_DEBUG yields iterator-comparison warnings during tests [\#492](https://github.com/nlohmann/json/issues/492)
- crapy interface [\#491](https://github.com/nlohmann/json/issues/491)
- Fix Visual Studo 2013 builds. [\#490](https://github.com/nlohmann/json/issues/490)
- Failed to compile with -D\_GLIBCXX\_PARALLEL [\#489](https://github.com/nlohmann/json/issues/489)
- Input several field with the same name [\#488](https://github.com/nlohmann/json/issues/488)
- read in .json file yields strange sizes [\#487](https://github.com/nlohmann/json/issues/487)
- json::value\_t can't be a map's key type in VC++ 2015 [\#486](https://github.com/nlohmann/json/issues/486)
- Using fifo\_map [\#485](https://github.com/nlohmann/json/issues/485)
- Cannot get float pointer for value stored as `0` [\#484](https://github.com/nlohmann/json/issues/484)
- byte string support [\#483](https://github.com/nlohmann/json/issues/483)
- For a header-only library you have to clone 214MB [\#482](https://github.com/nlohmann/json/issues/482)
- https://github.com/nlohmann/json\#execute-unit-tests [\#481](https://github.com/nlohmann/json/issues/481)
- Remove deprecated constructor basic\_json\(std::istream&\) [\#480](https://github.com/nlohmann/json/issues/480)
- writing the binary json file? [\#479](https://github.com/nlohmann/json/issues/479)
- CBOR/MessagePack from uint8\_t \* and size [\#478](https://github.com/nlohmann/json/issues/478)
- Streaming binary representations [\#477](https://github.com/nlohmann/json/issues/477)
- Reuse memory in to\_cbor and to\_msgpack functions [\#476](https://github.com/nlohmann/json/issues/476)
- Error Using JSON Library with arrays C++ [\#475](https://github.com/nlohmann/json/issues/475)
- Moving forward to version 3.0.0 [\#474](https://github.com/nlohmann/json/issues/474)
- Inconsistent behavior in conversion to array type [\#473](https://github.com/nlohmann/json/issues/473)
- Create a \[key:member\_pointer\] map to ease parsing custom types [\#471](https://github.com/nlohmann/json/issues/471)
- MSVC 2015 update 2 [\#469](https://github.com/nlohmann/json/issues/469)
- VS2017 implicit to std::string conversion fix. [\#464](https://github.com/nlohmann/json/issues/464)
- How to make sure a string or string literal is a valid JSON? [\#458](https://github.com/nlohmann/json/issues/458)
- basic\_json templated on a "policy" class [\#456](https://github.com/nlohmann/json/issues/456)
- json::value\(const json\_pointer&, ValueType\) requires exceptions to return the default value. [\#440](https://github.com/nlohmann/json/issues/440)
- is it possible merge two json object [\#428](https://github.com/nlohmann/json/issues/428)
- Is it possible to turn this into a shared library? [\#420](https://github.com/nlohmann/json/issues/420)
- Further thoughts on performance improvements [\#418](https://github.com/nlohmann/json/issues/418)
- nan number stored as null [\#388](https://github.com/nlohmann/json/issues/388)
- Behavior of operator\>\> should more closely resemble that of built-in overloads. [\#367](https://github.com/nlohmann/json/issues/367)
- Request: range-based-for over a json-object to expose .first/.second [\#350](https://github.com/nlohmann/json/issues/350)
- feature wish: JSONPath [\#343](https://github.com/nlohmann/json/issues/343)
- UTF-8/Unicode escape and dump [\#330](https://github.com/nlohmann/json/issues/330)
- Serialized value not always can be parsed. [\#329](https://github.com/nlohmann/json/issues/329)
- Is there a way to forward declare nlohmann::json? [\#314](https://github.com/nlohmann/json/issues/314)
- Exception line [\#301](https://github.com/nlohmann/json/issues/301)
- Do not throw exception when default\_value's type does not match the actual type [\#278](https://github.com/nlohmann/json/issues/278)
- dump\(\) method doesn't work with a custom allocator [\#268](https://github.com/nlohmann/json/issues/268)
- Readme documentation enhancements [\#248](https://github.com/nlohmann/json/issues/248)
- Use user-defined exceptions [\#244](https://github.com/nlohmann/json/issues/244)
- Incorrect C++11 allocator model support [\#161](https://github.com/nlohmann/json/issues/161)
- :white\_check\_mark: re-added tests for algorithms [\#879](https://github.com/nlohmann/json/pull/879) ([nlohmann](https://github.com/nlohmann))
- Overworked library toward 3.0.0 release [\#875](https://github.com/nlohmann/json/pull/875) ([nlohmann](https://github.com/nlohmann))
- :rotating\_light: remove C4996 warnings \#872 [\#873](https://github.com/nlohmann/json/pull/873) ([nlohmann](https://github.com/nlohmann))
- :boom: throwing an exception in case dump encounters a non-UTF-8 string \#838 [\#870](https://github.com/nlohmann/json/pull/870) ([nlohmann](https://github.com/nlohmann))
- :memo: fixing documentation \#867 [\#868](https://github.com/nlohmann/json/pull/868) ([nlohmann](https://github.com/nlohmann))
- iter\_impl template conformance with C++17 [\#860](https://github.com/nlohmann/json/pull/860) ([bogemic](https://github.com/bogemic))
- Std allocator conformance cpp17 [\#856](https://github.com/nlohmann/json/pull/856) ([bogemic](https://github.com/bogemic))
- cmake: use BUILD\_INTERFACE/INSTALL\_INTERFACE [\#855](https://github.com/nlohmann/json/pull/855) ([theodelrieu](https://github.com/theodelrieu))
- to/from\_json: add a MSVC-specific static\_assert to force a stacktrace [\#854](https://github.com/nlohmann/json/pull/854) ([theodelrieu](https://github.com/theodelrieu))
- Add .natvis for MSVC debug view [\#844](https://github.com/nlohmann/json/pull/844) ([TinyTinni](https://github.com/TinyTinni))
- Updated hunter package links [\#829](https://github.com/nlohmann/json/pull/829) ([jowr](https://github.com/jowr))
- Typos README [\#811](https://github.com/nlohmann/json/pull/811) ([Itja](https://github.com/Itja))
- add forwarding references to json\_ref constructor [\#807](https://github.com/nlohmann/json/pull/807) ([theodelrieu](https://github.com/theodelrieu))
- Add transparent comparator and perfect forwarding support to find\(\) and count\(\) [\#795](https://github.com/nlohmann/json/pull/795) ([jseward](https://github.com/jseward))
- Error : 'identifier "size\_t" is undefined' in linux [\#793](https://github.com/nlohmann/json/pull/793) ([sonulohani](https://github.com/sonulohani))
- Fix Visual Studio 2017 warnings [\#788](https://github.com/nlohmann/json/pull/788) ([jseward](https://github.com/jseward))
- Fix warning C4706 on Visual Studio 2017 [\#785](https://github.com/nlohmann/json/pull/785) ([jseward](https://github.com/jseward))
- Set GENERATE\_TAGFILE in Doxyfile [\#783](https://github.com/nlohmann/json/pull/783) ([eld00d](https://github.com/eld00d))
- using more CMake [\#765](https://github.com/nlohmann/json/pull/765) ([nlohmann](https://github.com/nlohmann))
- Simplified istream handing \#367 [\#764](https://github.com/nlohmann/json/pull/764) ([pjkundert](https://github.com/pjkundert))
- Add info for the vcpkg package. [\#753](https://github.com/nlohmann/json/pull/753) ([gregmarr](https://github.com/gregmarr))
- fix from\_json implementation for pair/tuple [\#708](https://github.com/nlohmann/json/pull/708) ([theodelrieu](https://github.com/theodelrieu))
- Update json.hpp [\#686](https://github.com/nlohmann/json/pull/686) ([GoWebProd](https://github.com/GoWebProd))
- Remove duplicate word [\#685](https://github.com/nlohmann/json/pull/685) ([daixtrose](https://github.com/daixtrose))
- To fix compilation issue for intel OSX compiler [\#682](https://github.com/nlohmann/json/pull/682) ([kbthomp1](https://github.com/kbthomp1))
- Digraph warning [\#679](https://github.com/nlohmann/json/pull/679) ([traits](https://github.com/traits))
- massage -\> message [\#678](https://github.com/nlohmann/json/pull/678) ([DmitryKuk](https://github.com/DmitryKuk))
- Fix "not constraint" grammar in docs [\#674](https://github.com/nlohmann/json/pull/674) ([wincent](https://github.com/wincent))
- Add documentation for integration with CMake and hunter [\#671](https://github.com/nlohmann/json/pull/671) ([dan-42](https://github.com/dan-42))
- REFACTOR: rewrite CMakeLists.txt for better inlcude and reuse [\#669](https://github.com/nlohmann/json/pull/669) ([dan-42](https://github.com/dan-42))
- enable\_testing only if the JSON\_BuildTests is ON [\#666](https://github.com/nlohmann/json/pull/666) ([effolkronium](https://github.com/effolkronium))
- Support moving from rvalues in std::initializer\_list [\#663](https://github.com/nlohmann/json/pull/663) ([himikof](https://github.com/himikof))
- add ensure\_ascii parameter to dump. \#330 [\#654](https://github.com/nlohmann/json/pull/654) ([ryanjmulder](https://github.com/ryanjmulder))
- Rename BuildTests to JSON\_BuildTests [\#652](https://github.com/nlohmann/json/pull/652) ([olegendo](https://github.com/olegendo))
- Don't include \<iostream\>, use std::make\_shared [\#650](https://github.com/nlohmann/json/pull/650) ([olegendo](https://github.com/olegendo))
- Refacto/split basic json [\#643](https://github.com/nlohmann/json/pull/643) ([theodelrieu](https://github.com/theodelrieu))
- fix typo in operator\_\_notequal example [\#630](https://github.com/nlohmann/json/pull/630) ([Chocobo1](https://github.com/Chocobo1))
- Fix MSVC warning C4819 [\#629](https://github.com/nlohmann/json/pull/629) ([Chocobo1](https://github.com/Chocobo1))
- \[BugFix\] Add parentheses around std::min [\#626](https://github.com/nlohmann/json/pull/626) ([koemeet](https://github.com/koemeet))
- add pair/tuple conversions [\#624](https://github.com/nlohmann/json/pull/624) ([theodelrieu](https://github.com/theodelrieu))
- remove std::pair support [\#615](https://github.com/nlohmann/json/pull/615) ([theodelrieu](https://github.com/theodelrieu))
- Add pair support, fix CompatibleObject conversions \(fixes \#600\) [\#609](https://github.com/nlohmann/json/pull/609) ([theodelrieu](https://github.com/theodelrieu))
- \#550 Fix iterator related compiling issues for Intel icc [\#598](https://github.com/nlohmann/json/pull/598) ([HenryRLee](https://github.com/HenryRLee))
- Issue \#593 Fix the arithmetic operators in the iterator and reverse iterator [\#595](https://github.com/nlohmann/json/pull/595) ([HenryRLee](https://github.com/HenryRLee))
- fix doxygen error of basic\_json::get\(\) [\#583](https://github.com/nlohmann/json/pull/583) ([zhaohuaxishi](https://github.com/zhaohuaxishi))
- Fixing assignement for iterator wrapper second, and adding unit test [\#579](https://github.com/nlohmann/json/pull/579) ([Type1J](https://github.com/Type1J))
- Adding first and second properties to iteration\_proxy\_internal [\#578](https://github.com/nlohmann/json/pull/578) ([Type1J](https://github.com/Type1J))
- Adding support for Meson. [\#576](https://github.com/nlohmann/json/pull/576) ([Type1J](https://github.com/Type1J))
- add enum class default conversions [\#545](https://github.com/nlohmann/json/pull/545) ([theodelrieu](https://github.com/theodelrieu))
- Properly pop diagnostics [\#540](https://github.com/nlohmann/json/pull/540) ([tinloaf](https://github.com/tinloaf))
- Add Visual Studio 17 image to appveyor build matrix [\#536](https://github.com/nlohmann/json/pull/536) ([vpetrigo](https://github.com/vpetrigo))
- UTF8 encoding enhancement [\#534](https://github.com/nlohmann/json/pull/534) ([TedLyngmo](https://github.com/TedLyngmo))
- Fix typo [\#530](https://github.com/nlohmann/json/pull/530) ([berkus](https://github.com/berkus))
- Make exception base class visible in basic\_json [\#526](https://github.com/nlohmann/json/pull/526) ([krzysztofwos](https://github.com/krzysztofwos))
- :art: Namespace `uint8\_t` from the C++ stdlib [\#510](https://github.com/nlohmann/json/pull/510) ([alex-weej](https://github.com/alex-weej))
- add to\_json method for C arrays [\#508](https://github.com/nlohmann/json/pull/508) ([theodelrieu](https://github.com/theodelrieu))
- Fix -Weffc++ warnings \(GNU 6.3.1\) [\#496](https://github.com/nlohmann/json/pull/496) ([TedLyngmo](https://github.com/TedLyngmo))
## [v2.1.1](https://github.com/nlohmann/json/releases/tag/v2.1.1) (2017-02-25)
[Full Changelog](https://github.com/nlohmann/json/compare/v2.1.0...v2.1.1)
- warning in the library [\#472](https://github.com/nlohmann/json/issues/472)
- How to create an array of Objects? [\#470](https://github.com/nlohmann/json/issues/470)
- \[Bug?\] Cannot get int pointer, but int64\_t works [\#468](https://github.com/nlohmann/json/issues/468)
- Illegal indirection [\#467](https://github.com/nlohmann/json/issues/467)
- in vs can't find linkageId [\#466](https://github.com/nlohmann/json/issues/466)
- Roundtrip error while parsing "1000000000000000010E5" [\#465](https://github.com/nlohmann/json/issues/465)
- C4996 error and warning with Visual Studio [\#463](https://github.com/nlohmann/json/issues/463)
- Support startIndex for from\_cbor/from\_msgpack [\#462](https://github.com/nlohmann/json/issues/462)
- question: monospace font used in feature slideshow? [\#460](https://github.com/nlohmann/json/issues/460)
- Object.keys\(\) [\#459](https://github.com/nlohmann/json/issues/459)
- Use “, “ as delimiter for json-objects. [\#457](https://github.com/nlohmann/json/issues/457)
- Enum -\> string during serialization and vice versa [\#455](https://github.com/nlohmann/json/issues/455)
- doubles are printed as integers [\#454](https://github.com/nlohmann/json/issues/454)
- Warnings with Visual Studio c++ \(VS2015 Update 3\) [\#453](https://github.com/nlohmann/json/issues/453)
- Heap-buffer-overflow \(OSS-Fuzz issue 585\) [\#452](https://github.com/nlohmann/json/issues/452)
- use of undeclared identifier 'UINT8\_MAX' [\#451](https://github.com/nlohmann/json/issues/451)
- Question on the lifetime managment of objects at the lower levels [\#449](https://github.com/nlohmann/json/issues/449)
- Json should not be constructible with 'json\*' [\#448](https://github.com/nlohmann/json/issues/448)
- Move value\_t to namespace scope [\#447](https://github.com/nlohmann/json/issues/447)
- Typo in README.md [\#446](https://github.com/nlohmann/json/issues/446)
- make check compilation is unneccesarily slow [\#445](https://github.com/nlohmann/json/issues/445)
- Problem in dump\(\) in json.h caused by ss.imbue [\#444](https://github.com/nlohmann/json/issues/444)
- I want to create Windows Application in Visual Studio 2015 c++, and i have a problem [\#443](https://github.com/nlohmann/json/issues/443)
- Implicit conversion issues [\#442](https://github.com/nlohmann/json/issues/442)
- Parsing of floats locale dependent [\#302](https://github.com/nlohmann/json/issues/302)
- Speedup CI builds using cotire [\#461](https://github.com/nlohmann/json/pull/461) ([tusharpm](https://github.com/tusharpm))
- TurpentineDistillery feature/locale independent str to num [\#450](https://github.com/nlohmann/json/pull/450) ([nlohmann](https://github.com/nlohmann))
- README: adjust boost::optional example [\#439](https://github.com/nlohmann/json/pull/439) ([jaredgrubb](https://github.com/jaredgrubb))
- fix \#414 - comparing to 0 literal [\#415](https://github.com/nlohmann/json/pull/415) ([stanmihai4](https://github.com/stanmihai4))
## [v2.1.0](https://github.com/nlohmann/json/releases/tag/v2.1.0) (2017-01-28)
[Full Changelog](https://github.com/nlohmann/json/compare/v2.0.10...v2.1.0)
- Parsing multiple JSON objects from a string or stream [\#438](https://github.com/nlohmann/json/issues/438)
- Use-of-uninitialized-value \(OSS-Fuzz issue 477\) [\#437](https://github.com/nlohmann/json/issues/437)
- add `reserve` function for array to reserve memory before adding json values into it [\#436](https://github.com/nlohmann/json/issues/436)
- Typo in examples page [\#434](https://github.com/nlohmann/json/issues/434)
- avoid malformed json [\#433](https://github.com/nlohmann/json/issues/433)
- How to add json objects to a map? [\#432](https://github.com/nlohmann/json/issues/432)
- create json instance from raw json \(unsigned char\*\) [\#431](https://github.com/nlohmann/json/issues/431)
- Getting std::invalid\_argument: stream error when following example [\#429](https://github.com/nlohmann/json/issues/429)
- Forward declare-only header? [\#427](https://github.com/nlohmann/json/issues/427)
- Implicit conversion from array to object [\#425](https://github.com/nlohmann/json/issues/425)
- Automatic ordered JSON [\#424](https://github.com/nlohmann/json/issues/424)
- error C4996: 'strerror' when reading file [\#422](https://github.com/nlohmann/json/issues/422)
- Get an error - JSON pointer must be empty or begin with '/' [\#421](https://github.com/nlohmann/json/issues/421)
- size parameter for parse\(\) [\#419](https://github.com/nlohmann/json/issues/419)
- json.hpp forcibly defines GCC\_VERSION [\#417](https://github.com/nlohmann/json/issues/417)
- Use-of-uninitialized-value \(OSS-Fuzz issue 377\) [\#416](https://github.com/nlohmann/json/issues/416)
- comparing to 0 literal [\#414](https://github.com/nlohmann/json/issues/414)
- Single char converted to ASCII code instead of string [\#413](https://github.com/nlohmann/json/issues/413)
- How to know if a string was parsed as utf-8? [\#406](https://github.com/nlohmann/json/issues/406)
- Overloaded += to add objects to an array makes no sense? [\#404](https://github.com/nlohmann/json/issues/404)
- Finding a value in an array [\#399](https://github.com/nlohmann/json/issues/399)
- add release information in static function [\#397](https://github.com/nlohmann/json/issues/397)
- Optimize memory usage of json objects in combination with binary serialization [\#373](https://github.com/nlohmann/json/issues/373)
- Conversion operators not considered [\#369](https://github.com/nlohmann/json/issues/369)
- Append ".0" to serialized floating\_point values that are digits-only. [\#362](https://github.com/nlohmann/json/issues/362)
- Add a customization point for user-defined types [\#328](https://github.com/nlohmann/json/issues/328)
- Conformance report for reference [\#307](https://github.com/nlohmann/json/issues/307)
- Document the best way to serialize/deserialize user defined types to json [\#298](https://github.com/nlohmann/json/issues/298)
- Add StringView template typename to basic\_json [\#297](https://github.com/nlohmann/json/issues/297)
- \[Improvement\] Add option to remove exceptions [\#296](https://github.com/nlohmann/json/issues/296)
- Performance in miloyip/nativejson-benchmark [\#202](https://github.com/nlohmann/json/issues/202)
- conversion from/to user-defined types [\#435](https://github.com/nlohmann/json/pull/435) ([nlohmann](https://github.com/nlohmann))
- Fix documentation error [\#430](https://github.com/nlohmann/json/pull/430) ([vjon](https://github.com/vjon))
- locale-independent num-to-str [\#378](https://github.com/nlohmann/json/pull/378) ([TurpentineDistillery](https://github.com/TurpentineDistillery))
## [v2.0.10](https://github.com/nlohmann/json/releases/tag/v2.0.10) (2017-01-02)
[Full Changelog](https://github.com/nlohmann/json/compare/v2.0.9...v2.0.10)
- Heap-buffer-overflow \(OSS-Fuzz issue 367\) [\#412](https://github.com/nlohmann/json/issues/412)
- Heap-buffer-overflow \(OSS-Fuzz issue 366\) [\#411](https://github.com/nlohmann/json/issues/411)
- Use-of-uninitialized-value \(OSS-Fuzz issue 347\) [\#409](https://github.com/nlohmann/json/issues/409)
- Heap-buffer-overflow \(OSS-Fuzz issue 344\) [\#408](https://github.com/nlohmann/json/issues/408)
- Heap-buffer-overflow \(OSS-Fuzz issue 343\) [\#407](https://github.com/nlohmann/json/issues/407)
- Heap-buffer-overflow \(OSS-Fuzz issue 342\) [\#405](https://github.com/nlohmann/json/issues/405)
- strerror throwing error in compiler VS2015 [\#403](https://github.com/nlohmann/json/issues/403)
- json::parse of std::string being underlined by Visual Studio [\#402](https://github.com/nlohmann/json/issues/402)
- Explicitly getting string without .dump\(\) [\#401](https://github.com/nlohmann/json/issues/401)
- Possible to speed up json::parse? [\#398](https://github.com/nlohmann/json/issues/398)
- the alphabetic order in the code influence console\_output. [\#396](https://github.com/nlohmann/json/issues/396)
- Execute tests with clang sanitizers [\#394](https://github.com/nlohmann/json/issues/394)
- Check if library can be used with ETL [\#361](https://github.com/nlohmann/json/issues/361)
- Feature/clang sanitize [\#410](https://github.com/nlohmann/json/pull/410) ([Daniel599](https://github.com/Daniel599))
- Add Doozer build badge [\#400](https://github.com/nlohmann/json/pull/400) ([andoma](https://github.com/andoma))
## [v2.0.9](https://github.com/nlohmann/json/releases/tag/v2.0.9) (2016-12-16)
[Full Changelog](https://github.com/nlohmann/json/compare/v2.0.8...v2.0.9)
- \#pragma GCC diagnostic ignored "-Wdocumentation" [\#393](https://github.com/nlohmann/json/issues/393)
- How to parse this json file and write separate sub object as json files? [\#392](https://github.com/nlohmann/json/issues/392)
- Integer-overflow \(OSS-Fuzz issue 267\) [\#389](https://github.com/nlohmann/json/issues/389)
- Implement indefinite-length types from RFC 7049 [\#387](https://github.com/nlohmann/json/issues/387)
- template parameter "T" is not used in declaring the parameter types of function template [\#386](https://github.com/nlohmann/json/issues/386)
- Serializing json instances containing already serialized string values without escaping [\#385](https://github.com/nlohmann/json/issues/385)
- Add test cases from RFC 7049 [\#384](https://github.com/nlohmann/json/issues/384)
- Add a table of contents to the README file [\#383](https://github.com/nlohmann/json/issues/383)
- Update FAQ section in the guidelines for contributing [\#382](https://github.com/nlohmann/json/issues/382)
- Allow for forward declaring nlohmann::json [\#381](https://github.com/nlohmann/json/issues/381)
- Bug in overflow detection when parsing integers [\#380](https://github.com/nlohmann/json/issues/380)
- A unique name to mention the library? [\#377](https://github.com/nlohmann/json/issues/377)
- Support for comments. [\#376](https://github.com/nlohmann/json/issues/376)
- Non-unique keys in objects. [\#375](https://github.com/nlohmann/json/issues/375)
- Request: binary serialization/deserialization [\#358](https://github.com/nlohmann/json/issues/358)
- Replace class iterator and const\_iterator by using a single template class to reduce code. [\#395](https://github.com/nlohmann/json/pull/395) ([Bosswestfalen](https://github.com/Bosswestfalen))
- Clang: quiet a warning [\#391](https://github.com/nlohmann/json/pull/391) ([jaredgrubb](https://github.com/jaredgrubb))
- Fix issue \#380: Signed integer overflow check [\#390](https://github.com/nlohmann/json/pull/390) ([qwename](https://github.com/qwename))
## [v2.0.8](https://github.com/nlohmann/json/releases/tag/v2.0.8) (2016-12-02)
[Full Changelog](https://github.com/nlohmann/json/compare/v2.0.7...v2.0.8)
- Reading from file [\#374](https://github.com/nlohmann/json/issues/374)
- Compiler warnings? [\#372](https://github.com/nlohmann/json/issues/372)
- docs: how to release a json object in memory? [\#371](https://github.com/nlohmann/json/issues/371)
- crash in dump [\#370](https://github.com/nlohmann/json/issues/370)
- Coverity issue \(FORWARD\_NULL\) in lexer\(std::istream& s\) [\#368](https://github.com/nlohmann/json/issues/368)
- json::parse on failed stream gets stuck [\#366](https://github.com/nlohmann/json/issues/366)
- Performance improvements [\#365](https://github.com/nlohmann/json/issues/365)
- 'to\_string' is not a member of 'std' [\#364](https://github.com/nlohmann/json/issues/364)
- Optional comment support. [\#363](https://github.com/nlohmann/json/issues/363)
- Crash in dump\(\) from a static object [\#359](https://github.com/nlohmann/json/issues/359)
- json::parse\(...\) vs json j; j.parse\(...\) [\#357](https://github.com/nlohmann/json/issues/357)
- Hi, is there any method to dump json to string with the insert order rather than alphabets [\#356](https://github.com/nlohmann/json/issues/356)
- Provide an example of reading from an json with only a key that has an array of strings. [\#354](https://github.com/nlohmann/json/issues/354)
- Request: access with default value. [\#353](https://github.com/nlohmann/json/issues/353)
- {} and \[\] causes parser error. [\#352](https://github.com/nlohmann/json/issues/352)
- Reading a JSON file into a JSON object [\#351](https://github.com/nlohmann/json/issues/351)
- Request: 'emplace\_back' [\#349](https://github.com/nlohmann/json/issues/349)
- Is it possible to stream data through the json parser without storing everything in memory? [\#347](https://github.com/nlohmann/json/issues/347)
- pure virtual conversion operator [\#346](https://github.com/nlohmann/json/issues/346)
- Floating point precision lost [\#345](https://github.com/nlohmann/json/issues/345)
- unit-conversions SIGSEGV on armv7hl [\#303](https://github.com/nlohmann/json/issues/303)
- Coverity scan fails [\#299](https://github.com/nlohmann/json/issues/299)
- Using QString as string type [\#274](https://github.com/nlohmann/json/issues/274)
## [v2.0.7](https://github.com/nlohmann/json/releases/tag/v2.0.7) (2016-11-02)
[Full Changelog](https://github.com/nlohmann/json/compare/v2.0.6...v2.0.7)
- ""-operators ignore the length parameter [\#340](https://github.com/nlohmann/json/issues/340)
- JSON5 [\#348](https://github.com/nlohmann/json/issues/348)
- Check "Parsing JSON is a Minefield" [\#344](https://github.com/nlohmann/json/issues/344)
- Allow hex numbers [\#342](https://github.com/nlohmann/json/issues/342)
- Convert strings to numbers [\#341](https://github.com/nlohmann/json/issues/341)
- ""-operators ignore the length parameter [\#340](https://github.com/nlohmann/json/issues/340)
- JSON into std::tuple [\#339](https://github.com/nlohmann/json/issues/339)
- JSON into vector [\#335](https://github.com/nlohmann/json/issues/335)
- Installing with Homebrew on Mac Errors \(El Capitan\) [\#331](https://github.com/nlohmann/json/issues/331)
- g++ make check results in error [\#312](https://github.com/nlohmann/json/issues/312)
- Cannot convert from 'json' to 'char' [\#276](https://github.com/nlohmann/json/issues/276)
- Please add a Pretty-Print option for arrays to stay always in one line [\#229](https://github.com/nlohmann/json/issues/229)
- Conversion to STL map\<string, vector\<int\>\> gives error [\#220](https://github.com/nlohmann/json/issues/220)
- std::unorderd\_map cannot be used as ObjectType [\#164](https://github.com/nlohmann/json/issues/164)
- fix minor grammar/style issue in README.md [\#336](https://github.com/nlohmann/json/pull/336) ([seeekr](https://github.com/seeekr))
## [v2.0.6](https://github.com/nlohmann/json/releases/tag/v2.0.6) (2016-10-15)
[Full Changelog](https://github.com/nlohmann/json/compare/v2.0.5...v2.0.6)
- How to handle json files? [\#333](https://github.com/nlohmann/json/issues/333)
- This file requires compiler and library support .... [\#332](https://github.com/nlohmann/json/issues/332)
- Segmentation fault on saving json to file [\#326](https://github.com/nlohmann/json/issues/326)
- parse error - unexpected \<uninitialized\> with 2.0.5 [\#325](https://github.com/nlohmann/json/issues/325)
- Add nested object capability to pointers [\#323](https://github.com/nlohmann/json/issues/323)
- make has\_mapped\_type struct friendly [\#324](https://github.com/nlohmann/json/pull/324) ([vpetrigo](https://github.com/vpetrigo))
- Fix usage examples' comments for std::multiset [\#322](https://github.com/nlohmann/json/issues/322)
- json\_unit runs forever when executed in build directory [\#319](https://github.com/nlohmann/json/issues/319)
- Visual studio 2015 update3 true != TRUE [\#317](https://github.com/nlohmann/json/issues/317)
- releasing single header file in compressed format [\#316](https://github.com/nlohmann/json/issues/316)
- json object from std::ifstream [\#315](https://github.com/nlohmann/json/issues/315)
- make has\_mapped\_type struct friendly [\#324](https://github.com/nlohmann/json/pull/324) ([vpetrigo](https://github.com/vpetrigo))
- Fix usage examples' comments for std::multiset [\#321](https://github.com/nlohmann/json/pull/321) ([vasild](https://github.com/vasild))
- Include dir relocation [\#318](https://github.com/nlohmann/json/pull/318) ([ChristophJud](https://github.com/ChristophJud))
- trivial documentation fix [\#313](https://github.com/nlohmann/json/pull/313) ([5tefan](https://github.com/5tefan))
@@ -26,33 +581,44 @@ All notable changes to this project will be documented in this file. This projec
## [v2.0.5](https://github.com/nlohmann/json/releases/tag/v2.0.5) (2016-09-14)
[Full Changelog](https://github.com/nlohmann/json/compare/v2.0.4...v2.0.5)
- \[feature request\]: schema validator and comments [\#311](https://github.com/nlohmann/json/issues/311)
- make json\_benchmarks no longer working in 2.0.4 [\#310](https://github.com/nlohmann/json/issues/310)
- Segmentation fault \(core dumped\) [\#309](https://github.com/nlohmann/json/issues/309)
- No matching member function for call to 'get\_impl' [\#308](https://github.com/nlohmann/json/issues/308)
## [v2.0.4](https://github.com/nlohmann/json/releases/tag/v2.0.4) (2016-09-11)
[Full Changelog](https://github.com/nlohmann/json/compare/v2.0.3...v2.0.4)
- Parsing fails without space at end of file [\#306](https://github.com/nlohmann/json/issues/306)
- json schema validator [\#305](https://github.com/nlohmann/json/issues/305)
- Unused variable warning [\#304](https://github.com/nlohmann/json/issues/304)
## [v2.0.3](https://github.com/nlohmann/json/releases/tag/v2.0.3) (2016-08-31)
[Full Changelog](https://github.com/nlohmann/json/compare/v2.0.2...v2.0.3)
- Support for iterator-range parsing [\#290](https://github.com/nlohmann/json/issues/290)
- warning C4706: assignment within conditional expression [\#295](https://github.com/nlohmann/json/issues/295)
- Strip comments / Minify [\#294](https://github.com/nlohmann/json/issues/294)
- Q: Is it possible to build json tree from already UTF8 encoded values? [\#293](https://github.com/nlohmann/json/issues/293)
- Equality operator results in array when assigned object [\#292](https://github.com/nlohmann/json/issues/292)
- Support for integers not from the range \[-\(2\*\*53\)+1, \(2\*\*53\)-1\] in parser [\#291](https://github.com/nlohmann/json/issues/291)
- Support for iterator-range parsing [\#290](https://github.com/nlohmann/json/issues/290)
- Horribly inconsistent behavior between const/non-const reference in operator \[\] \(\) [\#289](https://github.com/nlohmann/json/issues/289)
- Silently get numbers into smaller types [\#288](https://github.com/nlohmann/json/issues/288)
- Incorrect parsing of large int64\_t numbers [\#287](https://github.com/nlohmann/json/issues/287)
- \[question\]: macro to disable floating point support [\#284](https://github.com/nlohmann/json/issues/284)
- unit-constructor1.cpp: Fix floating point truncation warning [\#300](https://github.com/nlohmann/json/pull/300) ([t-b](https://github.com/t-b))
## [v2.0.2](https://github.com/nlohmann/json/releases/tag/v2.0.2) (2016-07-31)
[Full Changelog](https://github.com/nlohmann/json/compare/v2.0.1...v2.0.2)
- can function dump\(\) return string in the order I push in the json object ? [\#286](https://github.com/nlohmann/json/issues/286)
- Error on the Mac: Undefined symbols for architecture x86\_64 [\#285](https://github.com/nlohmann/json/issues/285)
- value\(\) does not work with \_json\_pointer types [\#283](https://github.com/nlohmann/json/issues/283)
- Easy serialization of classes [\#280](https://github.com/nlohmann/json/issues/280)
- Build error for std::int64 [\#282](https://github.com/nlohmann/json/issues/282)
- strings can't be accessed after dump\(\)-\>parse\(\) - type is lost [\#281](https://github.com/nlohmann/json/issues/281)
- Easy serialization of classes [\#280](https://github.com/nlohmann/json/issues/280)
- recursive data structures [\#277](https://github.com/nlohmann/json/issues/277)
- hexify\(\) function emits conversion warning [\#270](https://github.com/nlohmann/json/issues/270)
- let the makefile choose the correct sed [\#279](https://github.com/nlohmann/json/pull/279) ([murinicanor](https://github.com/murinicanor))
@@ -61,6 +627,7 @@ All notable changes to this project will be documented in this file. This projec
## [v2.0.1](https://github.com/nlohmann/json/releases/tag/v2.0.1) (2016-06-28)
[Full Changelog](https://github.com/nlohmann/json/compare/v2.0.0...v2.0.1)
- Compilation error. [\#273](https://github.com/nlohmann/json/issues/273)
- dump\(\) performance degradation in v2 [\#272](https://github.com/nlohmann/json/issues/272)
- fixed a tiny typo [\#271](https://github.com/nlohmann/json/pull/271) ([thelostt](https://github.com/thelostt))
@@ -68,43 +635,61 @@ All notable changes to this project will be documented in this file. This projec
## [v2.0.0](https://github.com/nlohmann/json/releases/tag/v2.0.0) (2016-06-23)
[Full Changelog](https://github.com/nlohmann/json/compare/v1.1.0...v2.0.0)
- concatenate objects [\#252](https://github.com/nlohmann/json/issues/252)
- Unit test fails when doing a CMake out-of-tree build [\#241](https://github.com/nlohmann/json/issues/241)
- Additional integration options [\#237](https://github.com/nlohmann/json/issues/237)
- Can't use basic\_json::iterator as a base iterator for std::move\_iterator [\#233](https://github.com/nlohmann/json/issues/233)
- Provide a FAQ [\#163](https://github.com/nlohmann/json/issues/163)
- Create PULL\_REQUEST\_TEMPLATE.md [\#213](https://github.com/nlohmann/json/pull/213) ([whackashoe](https://github.com/whackashoe))
- fixed noexcept; added constexpr [\#208](https://github.com/nlohmann/json/pull/208) ([nlohmann](https://github.com/nlohmann))
- Add support for afl-fuzz testing [\#207](https://github.com/nlohmann/json/pull/207) ([mykter](https://github.com/mykter))
- Issue \#178 - Extending support to full uint64\_t/int64\_t range and unsigned type \(updated\) [\#193](https://github.com/nlohmann/json/pull/193) ([twelsby](https://github.com/twelsby))
- json::diff generates incorrect patch when removing multiple array elements. [\#269](https://github.com/nlohmann/json/issues/269)
- Docs - What does Json\[key\] return? [\#267](https://github.com/nlohmann/json/issues/267)
- Compiler Errors With JSON.hpp [\#265](https://github.com/nlohmann/json/issues/265)
- Throw exception instead of crashing my app [\#264](https://github.com/nlohmann/json/issues/264)
- Ambiguous push\_back and operator+= overloads [\#263](https://github.com/nlohmann/json/issues/263)
- Preseving order of items in json [\#262](https://github.com/nlohmann/json/issues/262)
- '\' char problem in strings [\#261](https://github.com/nlohmann/json/issues/261)
- VS2015 compile fail [\#260](https://github.com/nlohmann/json/issues/260)
- -Wconversion warning [\#259](https://github.com/nlohmann/json/issues/259)
- Maybe a bug [\#258](https://github.com/nlohmann/json/issues/258)
- Few tests failed on Visual C++ 2015 [\#257](https://github.com/nlohmann/json/issues/257)
- Access keys when iteration with new for loop C++11 [\#256](https://github.com/nlohmann/json/issues/256)
- multiline text values [\#255](https://github.com/nlohmann/json/issues/255)
- Error when using json in g++ [\#254](https://github.com/nlohmann/json/issues/254)
- is the release 2.0? [\#253](https://github.com/nlohmann/json/issues/253)
- concatenate objects [\#252](https://github.com/nlohmann/json/issues/252)
- Encoding [\#251](https://github.com/nlohmann/json/issues/251)
- Unable to build example for constructing json object with stringstreams [\#250](https://github.com/nlohmann/json/issues/250)
- Hexadecimal support [\#249](https://github.com/nlohmann/json/issues/249)
- Update long-term goals [\#246](https://github.com/nlohmann/json/issues/246)
- Contribution To This Json Project [\#245](https://github.com/nlohmann/json/issues/245)
- Trouble using parser with initial dictionary [\#243](https://github.com/nlohmann/json/issues/243)
- Unit test fails when doing a CMake out-of-tree build [\#241](https://github.com/nlohmann/json/issues/241)
- -Wconversion warnings [\#239](https://github.com/nlohmann/json/issues/239)
- Additional integration options [\#237](https://github.com/nlohmann/json/issues/237)
- .get\<std::string\>\(\) works for non spaced string but returns as array for spaced/longer strings [\#236](https://github.com/nlohmann/json/issues/236)
- ambiguous overload for 'push\_back' and 'operator+=' [\#235](https://github.com/nlohmann/json/issues/235)
- Can't use basic\_json::iterator as a base iterator for std::move\_iterator [\#233](https://github.com/nlohmann/json/issues/233)
- json object's creation can freezes execution [\#231](https://github.com/nlohmann/json/issues/231)
- Incorrect dumping of parsed numbers with exponents, but without decimal places [\#230](https://github.com/nlohmann/json/issues/230)
- double values are serialized with commas as decimal points [\#228](https://github.com/nlohmann/json/issues/228)
- Move semantics with std::initializer\_list [\#225](https://github.com/nlohmann/json/issues/225)
- replace emplace [\#224](https://github.com/nlohmann/json/issues/224)
- abort during getline in yyfill [\#223](https://github.com/nlohmann/json/issues/223)
- free\(\): invalid pointer error in GCC 5.2.1 [\#221](https://github.com/nlohmann/json/issues/221)
- Error compile Android NDK error: 'strtof' is not a member of 'std' [\#219](https://github.com/nlohmann/json/issues/219)
- Wrong link in the README.md [\#217](https://github.com/nlohmann/json/issues/217)
- Wide character strings not supported [\#216](https://github.com/nlohmann/json/issues/216)
- Memory allocations using range-based for loops [\#214](https://github.com/nlohmann/json/issues/214)
- would you like to support gcc 4.8.1? [\#211](https://github.com/nlohmann/json/issues/211)
- Reading concatenated json's from an istream [\#210](https://github.com/nlohmann/json/issues/210)
- Conflicting typedef of ssize\_t on Windows 32 bit when using Boost.Python [\#204](https://github.com/nlohmann/json/issues/204)
- Inconsistency between operator\[\] and push\_back [\#203](https://github.com/nlohmann/json/issues/203)
- Small bugs in json.hpp \(get\_number\) and unit.cpp \(non-standard integer type test\) [\#199](https://github.com/nlohmann/json/issues/199)
- GCC/clang floating point parsing bug in strtod\(\) [\#195](https://github.com/nlohmann/json/issues/195)
- What is within scope? [\#192](https://github.com/nlohmann/json/issues/192)
- Bugs in miloyip/nativejson-benchmark: roundtrips [\#187](https://github.com/nlohmann/json/issues/187)
- Floating point exceptions [\#181](https://github.com/nlohmann/json/issues/181)
- In basic\_json::basic\_json\(const CompatibleArrayType& val\), the requirement of CompatibleArrayType is not strict enough. [\#174](https://github.com/nlohmann/json/issues/174)
- Implicit assignment to std::string fails [\#144](https://github.com/nlohmann/json/issues/144)
- Fix Issue \#265 [\#266](https://github.com/nlohmann/json/pull/266) ([06needhamt](https://github.com/06needhamt))
- Issue \#195 - update Travis to Trusty due to gcc/clang strtod\(\) bug [\#196](https://github.com/nlohmann/json/pull/196) ([twelsby](https://github.com/twelsby))
- Compiler Errors With JSON.hpp [\#265](https://github.com/nlohmann/json/issues/265)
- VS2015 compile fail [\#260](https://github.com/nlohmann/json/issues/260)
- Error when using json in g++ [\#254](https://github.com/nlohmann/json/issues/254)
- Update long-term goals [\#246](https://github.com/nlohmann/json/issues/246)
- Error compile Android NDK error: 'strtof' is not a member of 'std' [\#219](https://github.com/nlohmann/json/issues/219)
- Conflicting typedef of ssize\_t on Windows 32 bit when using Boost.Python [\#204](https://github.com/nlohmann/json/issues/204)
- Integer conversion to unsigned [\#178](https://github.com/nlohmann/json/issues/178)
- map string string fails to compile [\#176](https://github.com/nlohmann/json/issues/176)
- In basic\_json::basic\_json\(const CompatibleArrayType& val\), the requirement of CompatibleArrayType is not strict enough. [\#174](https://github.com/nlohmann/json/issues/174)
- Provide a FAQ [\#163](https://github.com/nlohmann/json/issues/163)
- Implicit assignment to std::string fails [\#144](https://github.com/nlohmann/json/issues/144)
- Fix Issue \#265 [\#266](https://github.com/nlohmann/json/pull/266) ([06needhamt](https://github.com/06needhamt))
- Define CMake/CTest tests [\#247](https://github.com/nlohmann/json/pull/247) ([robertmrk](https://github.com/robertmrk))
- Out of tree builds and a few other miscellaneous CMake cleanups. [\#242](https://github.com/nlohmann/json/pull/242) ([ChrisKitching](https://github.com/ChrisKitching))
- Implement additional integration options [\#238](https://github.com/nlohmann/json/pull/238) ([robertmrk](https://github.com/robertmrk))
@@ -113,72 +698,81 @@ All notable changes to this project will be documented in this file. This projec
- Use namespace std for int64\_t and uint64\_t [\#226](https://github.com/nlohmann/json/pull/226) ([lv-zheng](https://github.com/lv-zheng))
- Added missing cerrno header to fix ERANGE compile error on android [\#222](https://github.com/nlohmann/json/pull/222) ([Teemperor](https://github.com/Teemperor))
- Corrected readme [\#218](https://github.com/nlohmann/json/pull/218) ([Annihil](https://github.com/Annihil))
- Create PULL\_REQUEST\_TEMPLATE.md [\#213](https://github.com/nlohmann/json/pull/213) ([whackashoe](https://github.com/whackashoe))
- fixed noexcept; added constexpr [\#208](https://github.com/nlohmann/json/pull/208) ([nlohmann](https://github.com/nlohmann))
- Add support for afl-fuzz testing [\#207](https://github.com/nlohmann/json/pull/207) ([mykter](https://github.com/mykter))
- replaced ssize\_t occurrences with auto \(addresses \#204\) [\#205](https://github.com/nlohmann/json/pull/205) ([nlohmann](https://github.com/nlohmann))
- Fixed issue \#199 - Small bugs in json.hpp \(get\_number\) and unit.cpp \(non-standard integer type test\) [\#200](https://github.com/nlohmann/json/pull/200) ([twelsby](https://github.com/twelsby))
- Fix broken link [\#197](https://github.com/nlohmann/json/pull/197) ([vog](https://github.com/vog))
- Issue \#195 - update Travis to Trusty due to gcc/clang strtod\(\) bug [\#196](https://github.com/nlohmann/json/pull/196) ([twelsby](https://github.com/twelsby))
- Issue \#178 - Extending support to full uint64\_t/int64\_t range and unsigned type \(updated\) [\#193](https://github.com/nlohmann/json/pull/193) ([twelsby](https://github.com/twelsby))
## [v1.1.0](https://github.com/nlohmann/json/releases/tag/v1.1.0) (2016-01-24)
[Full Changelog](https://github.com/nlohmann/json/compare/v1.0.0...v1.1.0)
- JSON performance benchmark comparision [\#177](https://github.com/nlohmann/json/issues/177)
- Since re2c is often ignored in pull requests, it may make sense to make a contributing.md file [\#175](https://github.com/nlohmann/json/issues/175)
- Add assertions [\#168](https://github.com/nlohmann/json/issues/168)
- range based for loop for objects [\#83](https://github.com/nlohmann/json/issues/83)
- Implementation of get\_ref\(\) [\#184](https://github.com/nlohmann/json/pull/184) ([dariomt](https://github.com/dariomt))
- Small error in pull \#185 [\#194](https://github.com/nlohmann/json/issues/194)
- Bugs in miloyip/nativejson-benchmark: floating-point parsing [\#186](https://github.com/nlohmann/json/issues/186)
- Cannot index by key of type static constexpr const char\* [\#171](https://github.com/nlohmann/json/issues/171)
- Fixed Issue \#171 - added two extra template overloads of operator\[\] for T\* arguments [\#189](https://github.com/nlohmann/json/pull/189) ([twelsby](https://github.com/twelsby))
- Fixed issue \#167 - removed operator ValueType\(\) condition for VS2015 [\#188](https://github.com/nlohmann/json/pull/188) ([twelsby](https://github.com/twelsby))
- Floating point equality [\#185](https://github.com/nlohmann/json/issues/185)
- Unused variables in catch [\#180](https://github.com/nlohmann/json/issues/180)
- Typo in documentation [\#179](https://github.com/nlohmann/json/issues/179)
- JSON performance benchmark comparision [\#177](https://github.com/nlohmann/json/issues/177)
- Since re2c is often ignored in pull requests, it may make sense to make a contributing.md file [\#175](https://github.com/nlohmann/json/issues/175)
- Question about exceptions [\#173](https://github.com/nlohmann/json/issues/173)
- Android? [\#172](https://github.com/nlohmann/json/issues/172)
- Cannot index by key of type static constexpr const char\* [\#171](https://github.com/nlohmann/json/issues/171)
- Add assertions [\#168](https://github.com/nlohmann/json/issues/168)
- MSVC 2015 build fails when attempting to compare object\_t [\#167](https://github.com/nlohmann/json/issues/167)
- Member detector is not portable [\#166](https://github.com/nlohmann/json/issues/166)
- Unnecessary const\_cast [\#162](https://github.com/nlohmann/json/issues/162)
- Question about get\_ref\(\) [\#128](https://github.com/nlohmann/json/issues/128)
- range based for loop for objects [\#83](https://github.com/nlohmann/json/issues/83)
- Consider submitting this to the Boost Library Incubator [\#66](https://github.com/nlohmann/json/issues/66)
- Fixed Issue \#186 - add strto\(f|d|ld\) overload wrappers, "-0.0" special case and FP trailing zero [\#191](https://github.com/nlohmann/json/pull/191) ([twelsby](https://github.com/twelsby))
- Issue \#185 - remove approx\(\) and use \#pragma to kill warnings [\#190](https://github.com/nlohmann/json/pull/190) ([twelsby](https://github.com/twelsby))
- Fixed Issue \#171 - added two extra template overloads of operator\[\] for T\* arguments [\#189](https://github.com/nlohmann/json/pull/189) ([twelsby](https://github.com/twelsby))
- Fixed issue \#167 - removed operator ValueType\(\) condition for VS2015 [\#188](https://github.com/nlohmann/json/pull/188) ([twelsby](https://github.com/twelsby))
- Implementation of get\_ref\(\) [\#184](https://github.com/nlohmann/json/pull/184) ([dariomt](https://github.com/dariomt))
- Fixed some typos in CONTRIBUTING.md [\#182](https://github.com/nlohmann/json/pull/182) ([nibroc](https://github.com/nibroc))
## [v1.0.0](https://github.com/nlohmann/json/releases/tag/v1.0.0) (2015-12-27)
[Full Changelog](https://github.com/nlohmann/json/compare/v1.0.0-rc1...v1.0.0)
- add key name to exception [\#160](https://github.com/nlohmann/json/issues/160)
- prevent json.hpp from emitting compiler warnings [\#154](https://github.com/nlohmann/json/issues/154)
- json::parse\(string\) does not check utf8 bom [\#152](https://github.com/nlohmann/json/issues/152)
- unsigned 64bit values output as signed [\#151](https://github.com/nlohmann/json/issues/151)
- overload of at\(\) with default value [\#133](https://github.com/nlohmann/json/issues/133)
- Memory leak in face of exceptions [\#118](https://github.com/nlohmann/json/issues/118)
- Find and Count for arrays [\#117](https://github.com/nlohmann/json/issues/117)
- dynamically constructing an arbitrarily nested object [\#114](https://github.com/nlohmann/json/issues/114)
- object field accessors [\#103](https://github.com/nlohmann/json/issues/103)
- v8pp and json [\#95](https://github.com/nlohmann/json/issues/95)
- Wishlist [\#65](https://github.com/nlohmann/json/issues/65)
- Windows/Visual Studio \(through 2013\) is unsupported [\#62](https://github.com/nlohmann/json/issues/62)
- Bug in basic\_json::operator\[\] const overload [\#135](https://github.com/nlohmann/json/issues/135)
- wrong enable\_if for const pointer \(instead of pointer-to-const\) [\#134](https://github.com/nlohmann/json/issues/134)
- Visual Studio 14 Debug assertion failed [\#125](https://github.com/nlohmann/json/issues/125)
- Compile error with g++ 4.9.3 cygwin 64-bit [\#112](https://github.com/nlohmann/json/issues/112)
- error: unterminated raw string [\#109](https://github.com/nlohmann/json/issues/109)
- \[clang-3.6.2\] string/sstream with number to json issue [\#107](https://github.com/nlohmann/json/issues/107)
- Getting member discarding qualifyer [\#159](https://github.com/nlohmann/json/issues/159)
- basic\_json::iterator::value\(\) output includes quotes while basic\_json::iterator::key\(\) doesn't [\#158](https://github.com/nlohmann/json/issues/158)
- Indexing `const basic\_json\<\>` with `const basic\_string\<char\>` [\#157](https://github.com/nlohmann/json/issues/157)
- token\_type\_name\(token\_type t\): not all control paths return a value [\#156](https://github.com/nlohmann/json/issues/156)
- prevent json.hpp from emitting compiler warnings [\#154](https://github.com/nlohmann/json/issues/154)
- json::parse\(string\) does not check utf8 bom [\#152](https://github.com/nlohmann/json/issues/152)
- unsigned 64bit values output as signed [\#151](https://github.com/nlohmann/json/issues/151)
- Wish feature: json5 [\#150](https://github.com/nlohmann/json/issues/150)
- Unable to compile on MSVC 2015 with SDL checking enabled: This function or variable may be unsafe. [\#149](https://github.com/nlohmann/json/issues/149)
- "Json Object" type does not keep object order [\#148](https://github.com/nlohmann/json/issues/148)
- dump\(\) convert strings encoded by utf-8 to shift-jis on windows 10. [\#147](https://github.com/nlohmann/json/issues/147)
- Unable to get field names in a json object [\#145](https://github.com/nlohmann/json/issues/145)
- Question: Is the use of incomplete type correct? [\#138](https://github.com/nlohmann/json/issues/138)
- json.hpp:5746:32: error: 'to\_string' is not a member of 'std' [\#136](https://github.com/nlohmann/json/issues/136)
- Bug in basic\_json::operator\[\] const overload [\#135](https://github.com/nlohmann/json/issues/135)
- wrong enable\_if for const pointer \(instead of pointer-to-const\) [\#134](https://github.com/nlohmann/json/issues/134)
- overload of at\(\) with default value [\#133](https://github.com/nlohmann/json/issues/133)
- Splitting source [\#132](https://github.com/nlohmann/json/issues/132)
- Question about get\_ptr\(\) [\#127](https://github.com/nlohmann/json/issues/127)
- Visual Studio 14 Debug assertion failed [\#125](https://github.com/nlohmann/json/issues/125)
- Memory leak in face of exceptions [\#118](https://github.com/nlohmann/json/issues/118)
- Find and Count for arrays [\#117](https://github.com/nlohmann/json/issues/117)
- dynamically constructing an arbitrarily nested object [\#114](https://github.com/nlohmann/json/issues/114)
- Returning any data type [\#113](https://github.com/nlohmann/json/issues/113)
- Compile error with g++ 4.9.3 cygwin 64-bit [\#112](https://github.com/nlohmann/json/issues/112)
- insert json array issue with gcc4.8.2 [\#110](https://github.com/nlohmann/json/issues/110)
- error: unterminated raw string [\#109](https://github.com/nlohmann/json/issues/109)
- vector\<json\> copy constructor really weird [\#108](https://github.com/nlohmann/json/issues/108)
- \[clang-3.6.2\] string/sstream with number to json issue [\#107](https://github.com/nlohmann/json/issues/107)
- maintaining order of keys during iteration [\#106](https://github.com/nlohmann/json/issues/106)
- object field accessors [\#103](https://github.com/nlohmann/json/issues/103)
- v8pp and json [\#95](https://github.com/nlohmann/json/issues/95)
- Wishlist [\#65](https://github.com/nlohmann/json/issues/65)
- Windows/Visual Studio \(through 2013\) is unsupported [\#62](https://github.com/nlohmann/json/issues/62)
- Replace sprintf with hex function, this fixes \#149 [\#153](https://github.com/nlohmann/json/pull/153) ([whackashoe](https://github.com/whackashoe))
- Fix character skipping after a surrogate pair [\#146](https://github.com/nlohmann/json/pull/146) ([robertmrk](https://github.com/robertmrk))
@@ -194,65 +788,71 @@ All notable changes to this project will be documented in this file. This projec
- Use the right variable name in doc string [\#115](https://github.com/nlohmann/json/pull/115) ([whoshuu](https://github.com/whoshuu))
## [v1.0.0-rc1](https://github.com/nlohmann/json/releases/tag/v1.0.0-rc1) (2015-07-26)
- Finish documenting the public interface in Doxygen [\#102](https://github.com/nlohmann/json/issues/102)
- Binary string causes numbers to be dumped as hex [\#101](https://github.com/nlohmann/json/issues/101)
- failed to iterator json object with reverse\_iterator [\#100](https://github.com/nlohmann/json/issues/100)
- 'noexcept' : unknown override specifier [\#99](https://github.com/nlohmann/json/issues/99)
- json float parsing problem [\#98](https://github.com/nlohmann/json/issues/98)
- Adjust wording to JSON RFC [\#97](https://github.com/nlohmann/json/issues/97)
- 17 MB / 90 MB repo size!? [\#96](https://github.com/nlohmann/json/issues/96)
- static analysis warnings [\#94](https://github.com/nlohmann/json/issues/94)
- reverse\_iterator operator inheritance problem [\#93](https://github.com/nlohmann/json/issues/93)
- init error [\#92](https://github.com/nlohmann/json/issues/92)
- access by \(const\) reference [\#91](https://github.com/nlohmann/json/issues/91)
- is\_integer and is\_float tests [\#90](https://github.com/nlohmann/json/issues/90)
- Nonstandard integer type [\#89](https://github.com/nlohmann/json/issues/89)
- static library build [\#84](https://github.com/nlohmann/json/issues/84)
- lexer::get\_number return NAN [\#82](https://github.com/nlohmann/json/issues/82)
- MinGW have no std::to\_string [\#80](https://github.com/nlohmann/json/issues/80)
- Incorrect behaviour of basic\_json::count method [\#78](https://github.com/nlohmann/json/issues/78)
- Invoking is\_array\(\) function creates "null" value [\#77](https://github.com/nlohmann/json/issues/77)
- dump\(\) / parse\(\) not idempotent [\#76](https://github.com/nlohmann/json/issues/76)
- Handle infinity and NaN cases [\#70](https://github.com/nlohmann/json/issues/70)
- errors in g++-4.8.1 [\#68](https://github.com/nlohmann/json/issues/68)
- Keys when iterating over objects [\#67](https://github.com/nlohmann/json/issues/67)
- Compilation results in tons of warnings [\#64](https://github.com/nlohmann/json/issues/64)
- Complete brief documentation [\#61](https://github.com/nlohmann/json/issues/61)
- Double quotation mark is not parsed correctly [\#60](https://github.com/nlohmann/json/issues/60)
- Get coverage back to 100% [\#58](https://github.com/nlohmann/json/issues/58)
- erase elements using iterators [\#57](https://github.com/nlohmann/json/issues/57)
- Removing item from array [\#56](https://github.com/nlohmann/json/issues/56)
- Serialize/Deserialize like PHP? [\#55](https://github.com/nlohmann/json/issues/55)
- Numbers as keys [\#54](https://github.com/nlohmann/json/issues/54)
- Why are elements alphabetized on key while iterating? [\#53](https://github.com/nlohmann/json/issues/53)
- Document erase, count, and iterators key and value [\#52](https://github.com/nlohmann/json/issues/52)
- Do not use std::to\_string [\#51](https://github.com/nlohmann/json/issues/51)
- Supported compilers [\#50](https://github.com/nlohmann/json/issues/50)
- Confused about iterating through json objects [\#49](https://github.com/nlohmann/json/issues/49)
- Use non-member begin/end [\#48](https://github.com/nlohmann/json/issues/48)
- Erase key [\#47](https://github.com/nlohmann/json/issues/47)
- Key iterator [\#46](https://github.com/nlohmann/json/issues/46)
- Add count member function [\#45](https://github.com/nlohmann/json/issues/45)
- Printing attribute names [\#39](https://github.com/nlohmann/json/issues/39)
- Avoid using spaces when encoding without pretty print [\#31](https://github.com/nlohmann/json/issues/31)
- Cannot encode long numbers [\#30](https://github.com/nlohmann/json/issues/30)
- Creating an empty array [\#27](https://github.com/nlohmann/json/issues/27)
- Custom allocator support [\#25](https://github.com/nlohmann/json/issues/25)
- create a header-only version [\#16](https://github.com/nlohmann/json/issues/16)
- Add to\_string overload for indentation [\#13](https://github.com/nlohmann/json/issues/13)
- move code into namespace [\#9](https://github.com/nlohmann/json/issues/9)
- free functions for explicit objects and arrays in initializer lists [\#8](https://github.com/nlohmann/json/issues/8)
- Test case coverage [\#2](https://github.com/nlohmann/json/issues/2)
- Parse streams incrementally. [\#40](https://github.com/nlohmann/json/pull/40) ([aburgh](https://github.com/aburgh))
- Binary string causes numbers to be dumped as hex [\#101](https://github.com/nlohmann/json/issues/101)
- failed to iterator json object with reverse\_iterator [\#100](https://github.com/nlohmann/json/issues/100)
- static analysis warnings [\#94](https://github.com/nlohmann/json/issues/94)
- reverse\_iterator operator inheritance problem [\#93](https://github.com/nlohmann/json/issues/93)
- Nonstandard integer type [\#89](https://github.com/nlohmann/json/issues/89)
- lexer::get\_number return NAN [\#82](https://github.com/nlohmann/json/issues/82)
- Handle infinity and NaN cases [\#70](https://github.com/nlohmann/json/issues/70)
- errors in g++-4.8.1 [\#68](https://github.com/nlohmann/json/issues/68)
- Double quotation mark is not parsed correctly [\#60](https://github.com/nlohmann/json/issues/60)
- Do not use std::to\_string [\#51](https://github.com/nlohmann/json/issues/51)
- Confused about iterating through json objects [\#49](https://github.com/nlohmann/json/issues/49)
- Problem getting vector \(array\) of strings [\#44](https://github.com/nlohmann/json/issues/44)
- Compilation error due to assuming that private=public [\#43](https://github.com/nlohmann/json/issues/43)
- Use of deprecated implicit copy constructor [\#42](https://github.com/nlohmann/json/issues/42)
- Printing attribute names [\#39](https://github.com/nlohmann/json/issues/39)
- dumping a small number\_float just outputs 0.000000 [\#37](https://github.com/nlohmann/json/issues/37)
- find is error [\#32](https://github.com/nlohmann/json/issues/32)
- Avoid using spaces when encoding without pretty print [\#31](https://github.com/nlohmann/json/issues/31)
- Cannot encode long numbers [\#30](https://github.com/nlohmann/json/issues/30)
- segmentation fault when iterating over empty arrays/objects [\#28](https://github.com/nlohmann/json/issues/28)
- Creating an empty array [\#27](https://github.com/nlohmann/json/issues/27)
- Custom allocator support [\#25](https://github.com/nlohmann/json/issues/25)
- make the type of the used string container customizable [\#20](https://github.com/nlohmann/json/issues/20)
- Improper parsing of JSON string "\\" [\#17](https://github.com/nlohmann/json/issues/17)
- create a header-only version [\#16](https://github.com/nlohmann/json/issues/16)
- Don't return "const values" [\#15](https://github.com/nlohmann/json/issues/15)
- Add to\_string overload for indentation [\#13](https://github.com/nlohmann/json/issues/13)
- string parser does not recognize uncompliant strings [\#12](https://github.com/nlohmann/json/issues/12)
- free functions for explicit objects and arrays in initializer lists [\#8](https://github.com/nlohmann/json/issues/8)
- Runtime error in Travis job [\#1](https://github.com/nlohmann/json/issues/1)
- Fix compilation of json\_unit with GCC 5 [\#59](https://github.com/nlohmann/json/pull/59) ([dkopecek](https://github.com/dkopecek))
- Finish documenting the public interface in Doxygen [\#102](https://github.com/nlohmann/json/issues/102)
- 'noexcept' : unknown override specifier [\#99](https://github.com/nlohmann/json/issues/99)
- Keys when iterating over objects [\#67](https://github.com/nlohmann/json/issues/67)
- Complete brief documentation [\#61](https://github.com/nlohmann/json/issues/61)
- Get coverage back to 100% [\#58](https://github.com/nlohmann/json/issues/58)
- possible double-free in find function [\#11](https://github.com/nlohmann/json/issues/11)
- UTF-8 encoding/deconding/testing [\#10](https://github.com/nlohmann/json/issues/10)
- move code into namespace [\#9](https://github.com/nlohmann/json/issues/9)
- free functions for explicit objects and arrays in initializer lists [\#8](https://github.com/nlohmann/json/issues/8)
- unique\_ptr for ownership [\#7](https://github.com/nlohmann/json/issues/7)
- Add unit tests [\#4](https://github.com/nlohmann/json/issues/4)
- Drop C++98 support [\#3](https://github.com/nlohmann/json/issues/3)
- Test case coverage [\#2](https://github.com/nlohmann/json/issues/2)
- Runtime error in Travis job [\#1](https://github.com/nlohmann/json/issues/1)
- Keyword 'inline' is useless when member functions are defined in headers [\#87](https://github.com/nlohmann/json/pull/87) ([ahamez](https://github.com/ahamez))
- Remove useless typename [\#86](https://github.com/nlohmann/json/pull/86) ([ahamez](https://github.com/ahamez))
@@ -262,6 +862,8 @@ All notable changes to this project will be documented in this file. This projec
- support enum [\#71](https://github.com/nlohmann/json/pull/71) ([likebeta](https://github.com/likebeta))
- Fix performance regression introduced with the parsing callback feature. [\#69](https://github.com/nlohmann/json/pull/69) ([aburgh](https://github.com/aburgh))
- Improve the implementations of the comparission-operators [\#63](https://github.com/nlohmann/json/pull/63) ([Florianjw](https://github.com/Florianjw))
- Fix compilation of json\_unit with GCC 5 [\#59](https://github.com/nlohmann/json/pull/59) ([dkopecek](https://github.com/dkopecek))
- Parse streams incrementally. [\#40](https://github.com/nlohmann/json/pull/40) ([aburgh](https://github.com/aburgh))
- Feature/small float serialization [\#38](https://github.com/nlohmann/json/pull/38) ([jrandall](https://github.com/jrandall))
- template version with re2c scanner [\#36](https://github.com/nlohmann/json/pull/36) ([nlohmann](https://github.com/nlohmann))
- more descriptive documentation in example [\#33](https://github.com/nlohmann/json/pull/33) ([luxe](https://github.com/luxe))

View File

@@ -1,14 +1,13 @@
The library is licensed under the MIT License
<http://opensource.org/licenses/MIT>:
MIT License
Copyright (c) 2013-2016 Niels Lohmann
Copyright (c) 2013-2017 Niels Lohmann
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

209
Makefile
View File

@@ -1,18 +1,20 @@
.PHONY: pretty clean ChangeLog.md
# used programs
RE2C = re2c
SED = sed
# main target
all: json_unit
# clean up
clean:
rm -fr json_unit json_benchmarks fuzz fuzz-testing *.dSYM
rm -fr benchmarks/files/numbers/*.json
$(MAKE) clean -Cdoc
$(MAKE) clean -Ctest
all:
@echo "ChangeLog.md - generate ChangeLog file"
@echo "check - compile and execute test suite"
@echo "check-fast - compile and execute test suite (skip long-running tests)"
@echo "clean - remove built files"
@echo "coverage - create coverage information with lcov"
@echo "cppcheck - analyze code with cppcheck"
@echo "doctest - compile example files and check their output"
@echo "fuzz_testing - prepare fuzz testing of the JSON parser"
@echo "fuzz_testing_cbor - prepare fuzz testing of the CBOR parser"
@echo "fuzz_testing_msgpack - prepare fuzz testing of the MessagePack parser"
@echo "json_unit - create single-file test executable"
@echo "pedantic_clang - run Clang with maximal warning flags"
@echo "pedantic_gcc - run GCC with maximal warning flags"
@echo "pretty - beautify code with Artistic Style"
##########################################################################
@@ -21,14 +23,36 @@ clean:
# build unit tests
json_unit:
@$(MAKE) -C test
@$(MAKE) json_unit -C test
# run unit tests
check: json_unit
test/json_unit "*"
check:
$(MAKE) check -C test
check-fast: json_unit
test/json_unit
check-fast:
$(MAKE) check -C test TEST_PATTERN=""
# clean up
clean:
rm -fr json_unit json_benchmarks fuzz fuzz-testing *.dSYM test/*.dSYM
rm -fr benchmarks/files/numbers/*.json
rm -fr build_coverage
$(MAKE) clean -Cdoc
$(MAKE) clean -Ctest
$(MAKE) clean -Cbenchmarks
##########################################################################
# coverage
##########################################################################
coverage:
mkdir build_coverage
cd build_coverage ; CXX=g++-5 cmake .. -GNinja -DJSON_Coverage=ON
cd build_coverage ; ninja
cd build_coverage ; ctest
cd build_coverage ; ninja lcov_html
open build_coverage/test/html/index.html
##########################################################################
@@ -40,6 +64,97 @@ doctest:
$(MAKE) check_output -C doc
##########################################################################
# warning detector
##########################################################################
# calling Clang with all warnings, except:
# -Wno-documentation-unknown-command: code uses user-defined commands like @complexity
# -Wno-exit-time-destructors: warning in Catch code
# -Wno-keyword-macro: unit-tests use "#define private public"
# -Wno-deprecated-declarations: the library deprecated some functions
# -Wno-weak-vtables: exception class is defined inline, but has virtual method
# -Wno-range-loop-analysis: iterator_wrapper tests "for(const auto i...)"
# -Wno-float-equal: not all comparisons in the tests can be replaced by Approx
# -Wno-switch-enum -Wno-covered-switch-default: pedantic/contradicting warnings about switches
# -Wno-padded: padding is nothing to warn about
pedantic_clang:
$(MAKE) json_unit CXXFLAGS="\
-std=c++11 -Wno-c++98-compat -Wno-c++98-compat-pedantic \
-Werror \
-Weverything \
-Wno-documentation-unknown-command \
-Wno-exit-time-destructors \
-Wno-keyword-macro \
-Wno-deprecated-declarations \
-Wno-weak-vtables \
-Wno-range-loop-analysis \
-Wno-float-equal \
-Wno-switch-enum -Wno-covered-switch-default \
-Wno-padded"
# calling GCC with most warnings
pedantic_gcc:
$(MAKE) json_unit CXXFLAGS="\
-std=c++11 \
-Wno-deprecated-declarations \
-Werror \
-Wall -Wpedantic -Wextra \
-Walloca \
-Warray-bounds=2 \
-Wcast-qual -Wcast-align \
-Wchar-subscripts \
-Wconditionally-supported \
-Wconversion \
-Wdate-time \
-Wdeprecated \
-Wdisabled-optimization \
-Wdouble-promotion \
-Wduplicated-branches \
-Wduplicated-cond \
-Wformat-overflow=2 \
-Wformat-signedness \
-Wformat-truncation=2 \
-Wformat=2 \
-Wno-ignored-qualifiers \
-Wimplicit-fallthrough=5 \
-Wlogical-op \
-Wmissing-declarations \
-Wmissing-format-attribute \
-Wmissing-include-dirs \
-Wnoexcept \
-Wnonnull \
-Wnull-dereference \
-Wold-style-cast \
-Woverloaded-virtual \
-Wparentheses \
-Wplacement-new=2 \
-Wredundant-decls \
-Wreorder \
-Wrestrict \
-Wshadow=global \
-Wshift-overflow=2 \
-Wsign-conversion \
-Wsign-promo \
-Wsized-deallocation \
-Wstrict-overflow=5 \
-Wsuggest-attribute=const \
-Wsuggest-attribute=format \
-Wsuggest-attribute=noreturn \
-Wsuggest-attribute=pure \
-Wsuggest-final-methods \
-Wsuggest-final-types \
-Wsuggest-override \
-Wtrigraphs \
-Wundef \
-Wuninitialized -Wunknown-pragmas \
-Wunused \
-Wunused-const-variable=2 \
-Wunused-macros \
-Wunused-parameter \
-Wuseless-cast \
-Wvariadic-macros"
##########################################################################
# fuzzing
##########################################################################
@@ -48,15 +163,40 @@ doctest:
fuzz_testing:
rm -fr fuzz-testing
mkdir -p fuzz-testing fuzz-testing/testcases fuzz-testing/out
$(MAKE) fuzz CXX=afl-clang++
mv fuzz fuzz-testing
$(MAKE) parse_afl_fuzzer -C test CXX=afl-clang++
mv test/parse_afl_fuzzer fuzz-testing/fuzzer
find test/data/json_tests -size -5k -name *json | xargs -I{} cp "{}" fuzz-testing/testcases
@echo "Execute: afl-fuzz -i fuzz-testing/testcases -o fuzz-testing/out fuzz-testing/fuzz"
@echo "Execute: afl-fuzz -i fuzz-testing/testcases -o fuzz-testing/out fuzz-testing/fuzzer"
# the fuzzer binary
fuzz: test/src/fuzz.cpp src/json.hpp
$(CXX) -std=c++11 $(CXXFLAGS) $(FLAGS) $(CPPFLAGS) -I src $< $(LDFLAGS) -o $@
fuzz_testing_cbor:
rm -fr fuzz-testing
mkdir -p fuzz-testing fuzz-testing/testcases fuzz-testing/out
$(MAKE) parse_cbor_fuzzer -C test CXX=afl-clang++
mv test/parse_cbor_fuzzer fuzz-testing/fuzzer
find test/data -size -5k -name *.cbor | xargs -I{} cp "{}" fuzz-testing/testcases
@echo "Execute: afl-fuzz -i fuzz-testing/testcases -o fuzz-testing/out fuzz-testing/fuzzer"
fuzz_testing_msgpack:
rm -fr fuzz-testing
mkdir -p fuzz-testing fuzz-testing/testcases fuzz-testing/out
$(MAKE) parse_msgpack_fuzzer -C test CXX=afl-clang++
mv test/parse_msgpack_fuzzer fuzz-testing/fuzzer
find test/data -size -5k -name *.msgpack | xargs -I{} cp "{}" fuzz-testing/testcases
@echo "Execute: afl-fuzz -i fuzz-testing/testcases -o fuzz-testing/out fuzz-testing/fuzzer"
fuzzing-start:
afl-fuzz -S fuzzer1 -i fuzz-testing/testcases -o fuzz-testing/out fuzz-testing/fuzzer > /dev/null &
afl-fuzz -S fuzzer2 -i fuzz-testing/testcases -o fuzz-testing/out fuzz-testing/fuzzer > /dev/null &
afl-fuzz -S fuzzer3 -i fuzz-testing/testcases -o fuzz-testing/out fuzz-testing/fuzzer > /dev/null &
afl-fuzz -S fuzzer4 -i fuzz-testing/testcases -o fuzz-testing/out fuzz-testing/fuzzer > /dev/null &
afl-fuzz -S fuzzer5 -i fuzz-testing/testcases -o fuzz-testing/out fuzz-testing/fuzzer > /dev/null &
afl-fuzz -S fuzzer6 -i fuzz-testing/testcases -o fuzz-testing/out fuzz-testing/fuzzer > /dev/null &
afl-fuzz -S fuzzer7 -i fuzz-testing/testcases -o fuzz-testing/out fuzz-testing/fuzzer > /dev/null &
afl-fuzz -M fuzzer0 -i fuzz-testing/testcases -o fuzz-testing/out fuzz-testing/fuzzer
fuzzing-stop:
-killall fuzzer
-killall afl-fuzz
##########################################################################
# static analyzer
@@ -66,17 +206,11 @@ fuzz: test/src/fuzz.cpp src/json.hpp
cppcheck:
cppcheck --enable=warning --inconclusive --force --std=c++11 src/json.hpp --error-exitcode=1
clang_sanitize: clean
CXX=clang++ CXXFLAGS="-g -O2 -fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer" $(MAKE)
##########################################################################
# maintainer targets
##########################################################################
# create scanner with re2c
re2c: src/json.hpp.re2c
$(RE2C) -W --utf-8 --encoding-policy fail --bit-vectors --nested-ifs --no-debug-info $< | $(SED) '1d' > src/json.hpp
# pretty printer
pretty:
astyle --style=allman --indent=spaces=4 --indent-modifiers \
@@ -84,19 +218,8 @@ pretty:
--indent-col1-comments --pad-oper --pad-header --align-pointer=type \
--align-reference=type --add-brackets --convert-tabs --close-templates \
--lineend=linux --preserve-date --suffix=none --formatted \
src/json.hpp src/json.hpp.re2c test/src/*.cpp \
benchmarks/benchmarks.cpp doc/examples/*.cpp
##########################################################################
# benchmarks
##########################################################################
# benchmarks
json_benchmarks: benchmarks/benchmarks.cpp benchmarks/benchpress.hpp benchmarks/cxxopts.hpp src/json.hpp
cd benchmarks/files/numbers ; python generate.py
$(CXX) -std=c++11 $(CXXFLAGS) -DNDEBUG -O3 -flto -I src -I benchmarks $< $(LDFLAGS) -o $@
./json_benchmarks
src/json.hpp test/src/*.cpp \
benchmarks/src/benchmarks.cpp doc/examples/*.cpp
##########################################################################

541
README.md
View File

@@ -3,13 +3,36 @@
[![Build Status](https://travis-ci.org/nlohmann/json.svg?branch=master)](https://travis-ci.org/nlohmann/json)
[![Build Status](https://ci.appveyor.com/api/projects/status/1acb366xfyg3qybk/branch/develop?svg=true)](https://ci.appveyor.com/project/nlohmann/json)
[![Coverage Status](https://img.shields.io/coveralls/nlohmann/json.svg)](https://coveralls.io/r/nlohmann/json)
[![Try online](https://img.shields.io/badge/try-online-blue.svg)](http://melpon.org/wandbox/permlink/fsf5FqYe6GoX68W6)
[![Coverity Scan Build Status](https://scan.coverity.com/projects/5550/badge.svg)](https://scan.coverity.com/projects/nlohmann-json)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/f3732b3327e34358a0e9d1fe9f661f08)](https://www.codacy.com/app/nlohmann/json?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=nlohmann/json&amp;utm_campaign=Badge_Grade)
[![Try online](https://img.shields.io/badge/try-online-blue.svg)](https://wandbox.org/permlink/TZS6TQdqmEUcN8WW)
[![Documentation](https://img.shields.io/badge/docs-doxygen-blue.svg)](http://nlohmann.github.io/json)
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/nlohmann/json/master/LICENSE.MIT)
[![Github Releases](https://img.shields.io/github/release/nlohmann/json.svg)](https://github.com/nlohmann/json/releases)
[![Github Issues](https://img.shields.io/github/issues/nlohmann/json.svg)](http://github.com/nlohmann/json/issues)
[![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/nlohmann/json.svg)](http://isitmaintained.com/project/nlohmann/json "Average time to resolve an issue")
[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/289/badge)](https://bestpractices.coreinfrastructure.org/projects/289)
- [Design goals](#design-goals)
- [Integration](#integration)
- [Examples](#examples)
- [JSON as first-class data type](#json-as-first-class-data-type)
- [Serialization / Deserialization](#serialization--deserialization)
- [STL-like access](#stl-like-access)
- [Conversion from STL containers](#conversion-from-stl-containers)
- [JSON Pointer and JSON Patch](#json-pointer-and-json-patch)
- [Implicit conversions](#implicit-conversions)
- [Conversions to/from arbitrary types](#arbitrary-types-conversions)
- [Binary formats (CBOR and MessagePack)](#binary-formats-cbor-and-messagepack)
- [Supported compilers](#supported-compilers)
- [License](#license)
- [Contact](#contact)
- [Thanks](#thanks)
- [Used third-party tools](#used-third-party-tools)
- [Projects using JSON for Modern C++](#projects-using-json-for-modern-c)
- [Notes](#notes)
- [Execute unit tests](#execute-unit-tests)
## Design goals
There are myriads of [JSON](http://json.org) libraries out there, and each may even have its reason to exist. Our class had these design goals:
@@ -24,7 +47,7 @@ Other aspects were not so important to us:
- **Memory efficiency**. Each JSON object has an overhead of one pointer (the maximal size of a union) and one enumeration element (1 byte). The default generalization uses the following C++ data types: `std::string` for strings, `int64_t`, `uint64_t` or `double` for numbers, `std::map` for objects, `std::vector` for arrays, and `bool` for Booleans. However, you can template the generalized class `basic_json` to your needs.
- **Speed**. We currently implement the parser as naive [recursive descent parser](http://en.wikipedia.org/wiki/Recursive_descent_parser) with hand coded string handling. It is fast enough, but a [LALR-parser](http://en.wikipedia.org/wiki/LALR_parser) may be even faster (but would consist of more files which makes the integration harder).
- **Speed**. There are certainly [faster JSON libraries](https://github.com/miloyip/nativejson-benchmark#parsing-time) out there. However, if your goal is to speed up your development by adding JSON support with a single header, then this library is the way to go. If you know how to use a `std::vector` or `std::map`, you are already set.
See the [contribution guidelines](https://github.com/nlohmann/json/blob/master/.github/CONTRIBUTING.md#please-dont) for more information.
@@ -44,9 +67,23 @@ to the files you want to use JSON objects. That's it. Do not forget to set the n
: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`.
If you are using the [Meson Build System](http://mesonbuild.com), then you can wrap this repo as a subproject.
If you are using [Conan](https://www.conan.io/) to manage your dependencies, merely add `jsonformoderncpp/x.y.z@vthiery/stable` to your `conanfile.py`'s requires, where `x.y.z` is the release version you want to use. Please file issues [here](https://github.com/vthiery/conan-jsonformoderncpp/issues) if you experience problems with the packages.
If you are using [hunter](https://github.com/ruslo/hunter/) on your project for external dependencies, then you can use the [nlohmann_json package](https://docs.hunter.sh/en/latest/packages/pkg/nlohmann_json.html). Please see the hunter project for any issues regarding the packaging.
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.
:warning: [Version 3.0.0](https://github.com/nlohmann/json/wiki/Road-toward-3.0.0) is currently under development. Branch `develop` is used for the ongoing work and is probably **unstable**. Please use the `master` branch for the last stable version 2.1.1.
## Examples
Beside the examples below, you may want to check the [documentation](https://nlohmann.github.io/json/) where each function contains a separate code example (e.g., check out [`emplace()`](https://nlohmann.github.io/json/classnlohmann_1_1basic__json_a602f275f0359ab181221384989810604.html#a602f275f0359ab181221384989810604)). All [example files](https://github.com/nlohmann/json/tree/develop/doc/examples) can be compiled and executed on their own (e.g., file [emplace.cpp](https://github.com/nlohmann/json/blob/develop/doc/examples/emplace.cpp)).
### JSON as first-class data type
Here are some examples to give you an idea how to use the class.
Assume you want to create the JSON object
@@ -123,12 +160,14 @@ json empty_object_implicit = json({});
json empty_object_explicit = json::object();
// a way to express an _array_ of key/value pairs [["currency", "USD"], ["value", 42.99]]
json array_not_object = { json::array({"currency", "USD"}), json::array({"value", 42.99}) };
json array_not_object = json::array({ {"currency", "USD"}, {"value", 42.99} });
```
### Serialization / Deserialization
#### To/from strings
You can create an object (deserialization) by appending `_json` to a string literal:
```cpp
@@ -142,8 +181,14 @@ auto j2 = R"(
"pi": 3.141
}
)"_json;
```
// or explicitly
Note that without appending the `_json` suffix, the passed string literal is not parsed, but just used as JSON string value. That is, `json j = "{ \"happy\": true, \"pi\": 3.141 }"` would just store the string `"{ "happy": true, "pi": 3.141 }"` rather than parsing the actual object.
The above example can also be expressed explicitly using `json::parse()`:
```cpp
// parse explicitly
auto j3 = json::parse("{ \"happy\": true, \"pi\": 3.141 }");
```
@@ -162,6 +207,31 @@ std::cout << j.dump(4) << std::endl;
// }
```
Note the difference between serialization and assignment:
```cpp
// store a string in a JSON value
json j_string = "this is a string";
// retrieve the string value (implicit JSON to std::string conversion)
std::string cpp_string = j_string;
// retrieve the string value (explicit JSON to std::string conversion)
auto cpp_string2 = j_string.get<std::string>();
// retrieve the serialized value (explicit JSON serialization)
std::string serialized_string = j_string.dump();
// output of original string
std::cout << cpp_string << " == " << cpp_string2 << " == " << j_string.get<std::string>() << '\n';
// output of serialized value
std::cout << j_string << " == " << serialized_string << std::endl;
```
`.dump()` always returns the serialized value, and `.get<std::string>()` returns the originally stored string value.
#### To/from streams (e.g. files, string streams)
You can also use streams to serialize and deserialize:
```cpp
@@ -176,10 +246,37 @@ std::cout << j;
std::cout << std::setw(4) << j << std::endl;
```
These operators work for any subclasses of `std::istream` or `std::ostream`.
These operators work for any subclasses of `std::istream` or `std::ostream`. Here is the same example with files:
```cpp
// read a JSON file
std::ifstream i("file.json");
json j;
i >> j;
// write prettified JSON to another file
std::ofstream o("pretty.json");
o << std::setw(4) << j << std::endl;
```
Please note that setting the exception bit for `failbit` is inappropriate for this use case. It will result in program termination due to the `noexcept` specifier in use.
#### Read from iterator range
You can also read JSON from an iterator range; that is, from any container accessible by iterators whose content is stored as contiguous byte sequence, for instance a `std::vector<std::uint8_t>`:
```cpp
std::vector<std::uint8_t> v = {'t', 'r', 'u', 'e'};
json j = json::parse(v.begin(), v.end());
```
You may leave the iterators for the range [begin, end):
```cpp
std::vector<std::uint8_t> v = {'t', 'r', 'u', 'e'};
json j = json::parse(v);
```
### STL-like access
@@ -192,6 +289,9 @@ j.push_back("foo");
j.push_back(1);
j.push_back(true);
// also use emplace_back
j.emplace_back(1.78);
// iterate the array
for (json::iterator it = j.begin(); it != j.end(); ++it) {
std::cout << *it << '\n';
@@ -207,6 +307,9 @@ const std::string tmp = j[0];
j[1] = 42;
bool foo = j.at(2);
// comparison
j == "[\"foo\", 1, true]"_json; // true
// other stuff
j.size(); // 3 entries
j.empty(); // false
@@ -221,15 +324,15 @@ j.is_object();
j.is_array();
j.is_string();
// comparison
j == "[\"foo\", 1, true]"_json; // true
// create an object
json o;
o["foo"] = 23;
o["bar"] = false;
o["baz"] = 3.141;
// also use emplace
o.emplace("weather", "sunny");
// special iterator member functions for objects
for (json::iterator it = o.begin(); it != o.end(); ++it) {
std::cout << it.key() << " : " << it.value() << "\n";
@@ -251,7 +354,7 @@ o.erase("foo");
### Conversion from STL containers
Any sequence container (`std::array`, `std::vector`, `std::deque`, `std::forward_list`, `std::list`) whose values can be used to construct JSON types (e.g., integers, floating point numbers, Booleans, string types, or again STL containers described in this section) can be used to create a JSON array. The same holds for similar associative containers (`std::set`, `std::multiset`, `std::unordered_set`, `std::unordered_multiset`), but in these cases the order of the elements of the array depends how the elements are ordered in the respective STL container.
Any sequence container (`std::array`, `std::vector`, `std::deque`, `std::forward_list`, `std::list`) whose values can be used to construct JSON types (e.g., integers, floating point numbers, Booleans, string types, or again STL containers described in this section) can be used to create a JSON array. The same holds for similar associative containers (`std::set`, `std::multiset`, `std::unordered_set`, `std::unordered_multiset`), but in these cases the order of the elements of the array depends on how the elements are ordered in the respective STL container.
```cpp
std::vector<int> c_vector {1, 2, 3, 4};
@@ -291,7 +394,7 @@ json j_umset(c_umset); // both entries for "one" are used
// maybe ["one", "two", "one", "four"]
```
Likewise, any associative key-value containers (`std::map`, `std::multimap`, `std::unordered_map`, `std::unordered_multimap`) whose keys can construct an `std::string` and whose values can be used to construct JSON types (see examples above) can be used to to create a JSON object. Note that in case of multimaps only one key is used in the JSON object and the value depends on the internal order of the STL container.
Likewise, any associative key-value containers (`std::map`, `std::multimap`, `std::unordered_map`, `std::unordered_multimap`) whose keys can construct an `std::string` and whose values can be used to construct JSON types (see examples above) can be used to create a JSON object. Note that in case of multimaps only one key is used in the JSON object and the value depends on the internal order of the STL container.
```cpp
std::map<std::string, int> c_map { {"one", 1}, {"two", 2}, {"three", 3} };
@@ -383,14 +486,266 @@ int vi = jn.get<int>();
// etc.
```
### Arbitrary types conversions
Every type can be serialized in JSON, not just STL-containers and scalar types. Usually, you would do something along those lines:
```cpp
namespace ns {
// a simple struct to model a person
struct person {
std::string name;
std::string address;
int age;
};
}
ns::person p = {"Ned Flanders", "744 Evergreen Terrace", 60};
// convert to JSON: copy each value into the JSON object
json j;
j["name"] = p.name;
j["address"] = p.address;
j["age"] = p.age;
// ...
// convert from JSON: copy each value from the JSON object
ns::person p {
j["name"].get<std::string>(),
j["address"].get<std::string>(),
j["age"].get<int>()
};
```
It works, but that's quite a lot of boilerplate... Fortunately, there's a better way:
```cpp
// create a person
ns::person p {"Ned Flanders", "744 Evergreen Terrace", 60};
// conversion: person -> json
json j = p;
std::cout << j << std::endl;
// {"address":"744 Evergreen Terrace","age":60,"name":"Ned Flanders"}
// conversion: json -> person
ns::person p2 = j;
// that's it
assert(p == p2);
```
#### Basic usage
To make this work with one of your types, you only need to provide two functions:
```cpp
using nlohmann::json;
namespace ns {
void to_json(json& j, const person& p) {
j = json{{"name", p.name}, {"address", p.address}, {"age", p.age}};
}
void from_json(const json& j, person& p) {
p.name = j.at("name").get<std::string>();
p.address = j.at("address").get<std::string>();
p.age = j.at("age").get<int>();
}
} // namespace ns
```
That's all! When calling the `json` constructor with your type, your custom `to_json` method will be automatically called.
Likewise, when calling `get<your_type>()`, the `from_json` method will be called.
Some important things:
* Those methods **MUST** be in your type's namespace (which can be the global namespace), or the library will not be able to locate them (in this example, they are in namespace `ns`, where `person` is defined).
* When using `get<your_type>()`, `your_type` **MUST** be [DefaultConstructible](http://en.cppreference.com/w/cpp/concept/DefaultConstructible). (There is a way to bypass this requirement described later.)
* In function `from_json`, use function [`at()`](https://nlohmann.github.io/json/classnlohmann_1_1basic__json_a93403e803947b86f4da2d1fb3345cf2c.html#a93403e803947b86f4da2d1fb3345cf2c) to access the object values rather than `operator[]`. In case a key does not exist, `at` throws an exception that you can handle, whereas `operator[]` exhibits undefined behavior.
* In case your type contains several `operator=` definitions, code like `your_variable = your_json;` [may not compile](https://github.com/nlohmann/json/issues/667). You need to write `your_variable = your_json.get<decltype your_variable>();` instead.
* You do not need to add serializers or deserializers for STL types like `std::vector`: the library already implements these.
* Be careful with the definition order of the `from_json`/`to_json` functions: If a type `B` has a member of type `A`, you **MUST** define `to_json(A)` before `to_json(B)`. Look at [issue 561](https://github.com/nlohmann/json/issues/561) for more details.
#### How do I convert third-party types?
This requires a bit more advanced technique. But first, let's see how this conversion mechanism works:
The library uses **JSON Serializers** to convert types to json.
The default serializer for `nlohmann::json` is `nlohmann::adl_serializer` (ADL means [Argument-Dependent Lookup](http://en.cppreference.com/w/cpp/language/adl)).
It is implemented like this (simplified):
```cpp
template <typename T>
struct adl_serializer {
static void to_json(json& j, const T& value) {
// calls the "to_json" method in T's namespace
}
static void from_json(const json& j, T& value) {
// same thing, but with the "from_json" method
}
};
```
This serializer works fine when you have control over the type's namespace. However, what about `boost::optional`, or `std::filesystem::path` (C++17)? Hijacking the `boost` namespace is pretty bad, and it's illegal to add something other than template specializations to `std`...
To solve this, you need to add a specialization of `adl_serializer` to the `nlohmann` namespace, here's an example:
```cpp
// partial specialization (full specialization works too)
namespace nlohmann {
template <typename T>
struct adl_serializer<boost::optional<T>> {
static void to_json(json& j, const boost::optional<T>& opt) {
if (opt == boost::none) {
j = nullptr;
} else {
j = *opt; // this will call adl_serializer<T>::to_json which will
// find the free function to_json in T's namespace!
}
}
static void from_json(const json& j, boost::optional<T>& opt) {
if (j.is_null()) {
opt = boost::none;
} else {
opt = j.get<T>(); // same as above, but with
// adl_serializer<T>::from_json
}
}
};
}
```
#### How can I use `get()` for non-default constructible/non-copyable types?
There is a way, if your type is [MoveConstructible](http://en.cppreference.com/w/cpp/concept/MoveConstructible). You will need to specialize the `adl_serializer` as well, but with a special `from_json` overload:
```cpp
struct move_only_type {
move_only_type() = delete;
move_only_type(int ii): i(ii) {}
move_only_type(const move_only_type&) = delete;
move_only_type(move_only_type&&) = default;
int i;
};
namespace nlohmann {
template <>
struct adl_serializer<move_only_type> {
// note: the return type is no longer 'void', and the method only takes
// one argument
static move_only_type from_json(const json& j) {
return {j.get<int>()};
}
// Here's the catch! You must provide a to_json method! Otherwise you
// will not be able to convert move_only_type to json, since you fully
// specialized adl_serializer on that type
static void to_json(json& j, move_only_type t) {
j = t.i;
}
};
}
```
#### Can I write my own serializer? (Advanced use)
Yes. You might want to take a look at [`unit-udt.cpp`](https://github.com/nlohmann/json/blob/develop/test/src/unit-udt.cpp) in the test suite, to see a few examples.
If you write your own serializer, you'll need to do a few things:
* use a different `basic_json` alias than `nlohmann::json` (the last template parameter of `basic_json` is the `JSONSerializer`)
* use your `basic_json` alias (or a template parameter) in all your `to_json`/`from_json` methods
* use `nlohmann::to_json` and `nlohmann::from_json` when you need ADL
Here is an example, without simplifications, that only accepts types with a size <= 32, and uses ADL.
```cpp
// You should use void as a second template argument
// if you don't need compile-time checks on T
template<typename T, typename SFINAE = typename std::enable_if<sizeof(T) <= 32>::type>
struct less_than_32_serializer {
template <typename BasicJsonType>
static void to_json(BasicJsonType& j, T value) {
// we want to use ADL, and call the correct to_json overload
using nlohmann::to_json; // this method is called by adl_serializer,
// this is where the magic happens
to_json(j, value);
}
template <typename BasicJsonType>
static void from_json(const BasicJsonType& j, T& value) {
// same thing here
using nlohmann::from_json;
from_json(j, value);
}
};
```
Be **very** careful when reimplementing your serializer, you can stack overflow if you don't pay attention:
```cpp
template <typename T, void>
struct bad_serializer
{
template <typename BasicJsonType>
static void to_json(BasicJsonType& j, const T& value) {
// this calls BasicJsonType::json_serializer<T>::to_json(j, value);
// if BasicJsonType::json_serializer == bad_serializer ... oops!
j = value;
}
template <typename BasicJsonType>
static void to_json(const BasicJsonType& j, T& value) {
// this calls BasicJsonType::json_serializer<T>::from_json(j, value);
// if BasicJsonType::json_serializer == bad_serializer ... oops!
value = j.template get<T>(); // oops!
}
};
```
### Binary formats (CBOR and MessagePack)
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 [CBOR](http://cbor.io) (Concise Binary Object Representation) and [MessagePack](http://msgpack.org) to efficiently encode JSON values to byte vectors and to decode such vectors.
```cpp
// create a JSON value
json j = R"({"compact": true, "schema": 0})"_json;
// serialize to CBOR
std::vector<std::uint8_t> v_cbor = json::to_cbor(j);
// 0xa2, 0x67, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x63, 0x74, 0xf5, 0x66, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x00
// roundtrip
json j_from_cbor = json::from_cbor(v_cbor);
// serialize to MessagePack
std::vector<std::uint8_t> v_msgpack = json::to_msgpack(j);
// 0x82, 0xa7, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x63, 0x74, 0xc3, 0xa6, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x00
// roundtrip
json j_from_msgpack = json::from_msgpack(v_msgpack);
```
## Supported compilers
Though it's 2016 already, the support for C++11 is still a bit sparse. Currently, the following compilers are known to work:
Though it's 2017 already, the support for C++11 is still a bit sparse. Currently, the following compilers are known to work:
- GCC 4.9 - 6.0 (and possibly later)
- Clang 3.4 - 3.9 (and possibly later)
- GCC 4.9 - 7.2 (and possibly later)
- Clang 3.4 - 5.0 (and possibly later)
- Intel C++ Compiler 17.0.2 (and possibly later)
- Microsoft Visual C++ 2015 / Build Tools 14.0.25123.0 (and possibly later)
- Microsoft Visual C++ 2017 / Build Tools 15.5.180.51428 (and possibly later)
I would be happy to learn about other compilers/versions.
@@ -413,26 +768,28 @@ The following compilers are currently used in continuous integration at [Travis]
| Compiler | Operating System | Version String |
|-----------------|------------------------------|----------------|
| GCC 4.9.3 | Ubuntu 14.04.4 LTS | g++-4.9 (Ubuntu 4.9.3-8ubuntu2~14.04) 4.9.3 |
| GCC 5.3.0 | Ubuntu 14.04.4 LTS | g++-5 (Ubuntu 5.3.0-3ubuntu1~14.04) 5.3.0 20151204 |
| GCC 6.1.1 | Ubuntu 14.04.4 LTS | g++-6 (Ubuntu 6.1.1-3ubuntu11~14.04.1) 6.1.1 20160511 |
| Clang 3.6.0 | Ubuntu 14.04.4 LTS | clang version 3.6.0 (tags/RELEASE_360/final) |
| Clang 3.6.1 | Ubuntu 14.04.4 LTS | clang version 3.6.1 (tags/RELEASE_361/final) |
| Clang 3.6.2 | Ubuntu 14.04.4 LTS | clang version 3.6.2 (tags/RELEASE_362/final) |
| Clang 3.7.0 | Ubuntu 14.04.4 LTS | clang version 3.7.0 (tags/RELEASE_370/final) |
| Clang 3.7.1 | Ubuntu 14.04.4 LTS | clang version 3.7.1 (tags/RELEASE_371/final) |
| Clang 3.8.0 | Ubuntu 14.04.4 LTS | clang version 3.8.0 (tags/RELEASE_380/final) |
| Clang 3.8.1 | Ubuntu 14.04.4 LTS | clang version 3.8.1 (tags/RELEASE_381/final) |
| Clang Xcode 6.1 | Darwin Kernel Version 13.4.0 (OSX 10.9.5) | Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn) |
| Clang Xcode 6.2 | Darwin Kernel Version 13.4.0 (OSX 10.9.5) | Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn) |
| Clang Xcode 6.3 | Darwin Kernel Version 14.3.0 (OSX 10.10.3) | Apple LLVM version 6.1.0 (clang-602.0.49) (based on LLVM 3.6.0svn) |
| GCC 4.9.4 | Ubuntu 14.04.5 LTS | g++-4.9 (Ubuntu 4.9.4-2ubuntu1~14.04.1) 4.9.4 |
| GCC 5.4.1 | Ubuntu 14.04.5 LTS | g++-5 (Ubuntu 5.4.1-2ubuntu1~14.04) 5.4.1 20160904 |
| GCC 6.3.0 | Ubuntu 14.04.5 LTS | g++-6 (Ubuntu/Linaro 6.3.0-18ubuntu2~14.04) 6.3.0 20170519 |
| GCC 7.1.0 | Ubuntu 14.04.5 LTS | g++-7 (Ubuntu 7.1.0-5ubuntu2~14.04) 7.1.0
| Clang 3.5.0 | Ubuntu 14.04.5 LTS | clang version 3.5.0-4ubuntu2~trusty2 (tags/RELEASE_350/final) |
| Clang 3.6.2 | Ubuntu 14.04.5 LTS | clang version 3.6.2-svn240577-1~exp1 (branches/release_36) |
| Clang 3.7.1 | Ubuntu 14.04.5 LTS | clang version 3.7.1-svn253571-1~exp1 (branches/release_37) |
| Clang 3.8.0 | Ubuntu 14.04.5 LTS | clang version 3.8.0-2ubuntu3~trusty5 (tags/RELEASE_380/final) |
| Clang 3.9.1 | Ubuntu 14.04.5 LTS | clang version 3.9.1-4ubuntu3~14.04.2 (tags/RELEASE_391/rc2) |
| Clang 4.0.1 | Ubuntu 14.04.5 LTS | clang version 4.0.1-svn305264-1~exp1 (branches/release_40) |
| Clang 5.0.0 | Ubuntu 14.04.5 LTS | clang version 5.0.0-svn310902-1~exp1 (branches/release_50) |
| Clang Xcode 6.4 | Darwin Kernel Version 14.3.0 (OSX 10.10.3) | Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn) |
| Clang Xcode 7.1 | Darwin Kernel Version 14.5.0 (OSX 10.10.5) | Apple LLVM version 7.0.0 (clang-700.1.76) |
| Clang Xcode 7.2 | Darwin Kernel Version 15.0.0 (OSX 10.10.5) | Apple LLVM version 7.0.2 (clang-700.1.81) |
| Clang Xcode 7.3 | Darwin Kernel Version 15.0.0 (OSX 10.10.5) | Apple LLVM version 7.3.0 (clang-703.0.29) |
| Clang Xcode 8.0 | Darwin Kernel Version 15.6.0 (OSX 10.11.6) | Apple LLVM version 8.0.0 (clang-800.0.38) |
| Visual Studio 14 2015 | Windows Server 2012 R2 (x64) | Microsoft (R) Build Engine version 14.0.25123.0 |
| Clang Xcode 8.0 | Darwin Kernel Version 15.6.0 | Apple LLVM version 8.0.0 (clang-800.0.38) |
| Clang Xcode 8.1 | Darwin Kernel Version 16.1.0 (macOS 10.12.1) | Apple LLVM version 8.0.0 (clang-800.0.42.1) |
| Clang Xcode 8.2 | Darwin Kernel Version 16.1.0 (macOS 10.12.1) | Apple LLVM version 8.0.0 (clang-800.0.42.1) |
| Clang Xcode 8.3 | Darwin Kernel Version 16.5.0 (macOS 10.12.4) | Apple LLVM version 8.1.0 (clang-802.0.38) |
| Clang Xcode 9.0 | Darwin Kernel Version 16.7.0 (macOS 10.12.6) | Apple LLVM version 9.0.0 (clang-900.0.37) |
| Clang Xcode 9.1 | Darwin Kernel Version 16.7.0 (macOS 10.12.6) | Apple LLVM version 9.0.0 (clang-900.0.38) |
| Clang Xcode 9.2 | Darwin Kernel Version 16.7.0 (macOS 10.12.6) | Apple LLVM version 8.1.0 (clang-900.0.39.2) |
| Visual Studio 14 2015 | Windows Server 2012 R2 (x64) | Microsoft (R) Build Engine version 14.0.25420.1, MSVC 19.0.24215.1 |
| Visual Studio 2017 | Windows Server 2016 | Microsoft (R) Build Engine version 15.5.180.51428, MSVC 19.12.25830.2 |
## License
@@ -440,7 +797,7 @@ The following compilers are currently used in continuous integration at [Travis]
The class is licensed under the [MIT License](http://opensource.org/licenses/MIT):
Copyright &copy; 2013-2016 [Niels Lohmann](http://nlohmann.me)
Copyright &copy; 2013-2017 [Niels Lohmann](http://nlohmann.me)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
@@ -448,11 +805,23 @@ The above copyright notice and this permission notice shall be included in all c
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* * *
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 &copy; 2008-2009 [Björn Hoehrmann](http://bjoern.hoehrmann.de/) <bjoern@hoehrmann.de>
## Contact
If you have questions regarding the library, I would like to invite you to [open an issue at Github](https://github.com/nlohmann/json/issues/new). Please describe your request, problem, or question as detailed as possible, and also mention the version of the library you are using as well as the version of your compiler and operating system. Opening an issue at Github allows other users and contributors to this library to collaborate. For instance, I have little experience with MSVC, and most issues in this regard have been solved by a growing community. If you have a look at the [closed issues](https://github.com/nlohmann/json/issues?q=is%3Aissue+is%3Aclosed), you will see that we react quite timely in most cases.
Only if your request would contain confidential information, please [send me an email](mailto:mail@nlohmann.me). For encrypted messages, please use [this key](https://keybase.io/nlohmann/pgp_keys.asc).
## Thanks
I deeply appreciate the help of the following people.
![Contributors](https://raw.githubusercontent.com/nlohmann/json/develop/doc/avatars.png)
- [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.
- [kirkshoop](https://github.com/kirkshoop) made the iterators of the class composable to other libraries.
@@ -465,7 +834,7 @@ I deeply appreciate the help of the following people.
- [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.
- [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.
- [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.
- [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.
@@ -493,14 +862,97 @@ I deeply appreciate the help of the following people.
- [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.
- [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).
- [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.
- [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`.
- [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.
- [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.
- [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()`](http://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.
- [Jared Grubb](https://github.com/jaredgrubb) silenced a nasty documentation warning.
- [Yixin Zhang](https://github.com/qwename) fixed an integer overflow check.
- [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.
- [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.
- [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.
- [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.
- [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.
- [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.
- [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.
- [ftillier](https://github.com/ftillier) fixed a compiler warning.
- [tinloaf](https://github.com/tinloaf) made sure all pushed warnings are properly popped.
- [Fytch](https://github.com/Fytch) found a bug in the documentation.
- [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.
- [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`.
- [Mike Tzou](https://github.com/Chocobo1) fixed some typos.
- [amrcode](https://github.com/amrcode) noted a missleading documentation about comparison of floats.
- [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.
- [Nikita Ofitserov](https://github.com/himikof) allowed for moving values from initializer lists.
- [Greg Hurrell](https://github.com/wincent) fixed a typo.
- [Dmitry Kukovinets](https://github.com/DmitryKuk) fixed a typo.
- [kbthomp1](https://github.com/kbthomp1) fixed an issue related to the Intel OSX compiler.
- [Markus Werle](https://github.com/daixtrose) fixed a typo.
- [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.
- [Tom de Geus](https://github.com/tdegeus) reported some warnings with ICC and helped fixing them.
- [Perry Kundert](https://github.com/pjkundert) simplified reading from input streams.
- [Sonu Lohani](https://github.com/sonulohani) fixed a small compilation error.
- [Jamie Seward](https://github.com/jseward) fixed all MSVC warnings.
- [Nate Vargas](https://github.com/eld00d) added a Doxygen tag file.
- [pvleuven](https://github.com/pvleuven) helped fixing a warning in ICC.
- [Pavel](https://github.com/crea7or) helped fixing some warnings in MSVC.
- [Jamie Seward](https://github.com/jseward) avoided unneccessary string copies in `find()` and `count()`.
- [Mitja](https://github.com/Itja) fixed some typos.
- [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.
- [bogemic](https://github.com/bogemic) fixed some C++17 deprecation warnings.
Thanks a lot for helping out!
Thanks a lot for helping out! Please [let me know](mailto:mail@nlohmann.me) if I forgot someone.
## Used third-party tools
The library itself contains 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!
- [**American fuzzy lop**](http://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 identation
- [**benchpress**](https://github.com/sbs-ableton/benchpress) to benchmark the code
- [**Catch**](https://github.com/philsquared/Catch) for the unit tests
- [**Clang**](http://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)
- [**Coveralls**](https://coveralls.io) to measure [code coverage](https://coveralls.io/github/nlohmann/json)
- [**Coverity Scan**](https://scan.coverity.com) for [static analysis](https://scan.coverity.com/projects/nlohmann-json)
- [**cppcheck**](http://cppcheck.sourceforge.net) for static analysis
- [**cxxopts**](https://github.com/jarro2783/cxxopts) to let benchpress parse command-line parameters
- [**Doxygen**](http://www.stack.nl/~dimitri/doxygen/) to generate [documentation](https://nlohmann.github.io/json/)
- [**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)
- [**libFuzzer**](http://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
- [**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/TZS6TQdqmEUcN8WW)
## Projects using JSON for Modern C++
The library is currently used in Apple macOS Sierra and iOS 10. I am not sure what they are using the library for, but I am happy that it runs on so many devices.
## Notes
@@ -509,29 +961,24 @@ Thanks a lot for helping out!
- As the exact type of a number is not defined in the [JSON specification](http://rfc7159.net/rfc7159), this library tries to choose the best fitting C++ number type automatically. As a result, the type `double` may be used to store numbers which may yield [**floating-point exceptions**](https://github.com/nlohmann/json/issues/181) in certain rare situations if floating-point exceptions have been unmasked in the calling code. These exceptions are not caused by the library and need to be fixed in the calling code, such as by re-masking the exceptions prior to calling library functions.
- The library supports **Unicode input** as follows:
- Only **UTF-8** encoded input is supported which is the default encoding for JSON according to [RFC 7159](http://rfc7159.net/rfc7159#rfc.section.8.1).
- Other encodings such as Latin-1, UTF-16, or UTF-32 are not supported and will yield parse errors.
- Other encodings such as Latin-1, UTF-16, or UTF-32 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.
- 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.
- The code can be compiled without C++ **runtime type identification** features; that is, you can use the `-fno-rtti` compiler flag.
- **Exceptions** are used widely within the library. They can, however, be switched off with either using the compiler flag `-fno-exceptions` or by defining the symbol `JSON_NOEXCEPTION`. In this case, exceptions are replaced by an `abort()` call.
- By default, the library does not preserve the **insertion order of object elements**. This is standards-compliant, as the [JSON standard](https://tools.ietf.org/html/rfc7159.html) defines objects as "an unordered collection of zero or more name/value pairs". If you do want to preserve the insertion order, you can specialize the object type with containers like [`tsl::ordered_map`](https://github.com/Tessil/ordered-map) ([integration](https://github.com/nlohmann/json/issues/546#issuecomment-304447518)) or [`nlohmann::fifo_map`](https://github.com/nlohmann/fifo_map) ([integration](https://github.com/nlohmann/json/issues/485#issuecomment-333652309)).
## Execute unit tests
To compile and run the tests, you need to execute
```sh
$ make check
===============================================================================
All tests passed (8905491 assertions in 36 test cases)
```
Alternatively, you can use [CMake](https://cmake.org) and run
```sh
$ mkdir build
$ cd build
$ cmake ..
$ make
$ cmake --build .
$ ctest
```

View File

@@ -1,10 +1,27 @@
version: '{build}'
os: Visual Studio 2015
init: []
install: []
build_script:
- set PATH=C:\Program Files (x86)\MSBuild\14.0\Bin;%PATH%
- cmake . -G "Visual Studio 14 2015"
- cmake --build . --config Release
test_script:
- ctest -C Release -V
version: '{build}'
os:
- Visual Studio 2015
- Visual Studio 2017
environment:
matrix:
- additional_flags: ""
- additional_flags: "/permissive- /std:c++latest /utf-8"
matrix:
exclude:
- additional_flags: "/permissive- /std:c++latest /utf-8"
os: Visual Studio 2015
init: []
install: []
build_script:
- IF "%APPVEYOR_BUILD_WORKER_IMAGE%" == "Visual Studio 2015" ( SET GEN="Visual Studio 14 2015") ELSE (SET GEN="Visual Studio 15 2017")
- cmake . -G%GEN% -DCMAKE_CXX_FLAGS="%additional_flags%"
- cmake --build . --config Release
test_script:
- ctest -C Release -V -j

21
benchmarks/Makefile Normal file
View File

@@ -0,0 +1,21 @@
#
# Build/run json.hpp benchmarks, eg. CXX=g++-7 make
#
# The existing json_benchmarks did not allow optimization under some compilers
#
all: json_benchmarks json_benchmarks_simple number_jsons
bash -c 'time ./json_benchmarks'
bash -c 'time ./json_benchmarks_simple'
json_benchmarks: src/benchmarks.cpp ../src/json.hpp
$(CXX) -std=c++11 -pthread $(CXXFLAGS) -DNDEBUG -O3 -flto -I thirdparty/benchpress -I thirdparty/cxxopts -I../src src/benchmarks.cpp $(LDFLAGS) -o $@
json_benchmarks_simple: src/benchmarks_simple.cpp ../src/json.hpp
$(CXX) -std=c++11 $(CXXFLAGS) -DNDEBUG -O3 -flto -I../src $(<) $(LDFLAGS) -o $@
number_jsons:
(test -e files/numbers/floats.json -a -e files/numbers/signed_ints.json -a -e files/numbers/unsigned_ints.json) || (cd files/numbers ; python generate.py)
clean:
rm -f json_benchmarks json_benchmarks_simple files/numbers/*.json

3
benchmarks/README.md Normal file
View File

@@ -0,0 +1,3 @@
# Bechmarks
Run `make` to compile and run a small set of benchmarks.

View File

@@ -1,107 +0,0 @@
#define BENCHPRESS_CONFIG_MAIN
#include <fstream>
#include <benchpress.hpp>
#include <json.hpp>
BENCHMARK("parse jeopardy.json", [](benchpress::context* ctx)
{
for (size_t i = 0; i < ctx->num_iterations(); ++i)
{
std::ifstream input_file("benchmarks/files/jeopardy/jeopardy.json");
nlohmann::json j;
j << input_file;
}
})
BENCHMARK("parse canada.json", [](benchpress::context* ctx)
{
for (size_t i = 0; i < ctx->num_iterations(); ++i)
{
std::ifstream input_file("benchmarks/files/nativejson-benchmark/canada.json");
nlohmann::json j;
j << input_file;
}
})
BENCHMARK("parse citm_catalog.json", [](benchpress::context* ctx)
{
for (size_t i = 0; i < ctx->num_iterations(); ++i)
{
std::ifstream input_file("benchmarks/files/nativejson-benchmark/citm_catalog.json");
nlohmann::json j;
j << input_file;
}
})
BENCHMARK("parse twitter.json", [](benchpress::context* ctx)
{
for (size_t i = 0; i < ctx->num_iterations(); ++i)
{
std::ifstream input_file("benchmarks/files/nativejson-benchmark/twitter.json");
nlohmann::json j;
j << input_file;
}
})
BENCHMARK("parse numbers/floats.json", [](benchpress::context* ctx)
{
for (size_t i = 0; i < ctx->num_iterations(); ++i)
{
std::ifstream input_file("benchmarks/files/numbers/floats.json");
nlohmann::json j;
j << input_file;
}
})
BENCHMARK("parse numbers/signed_ints.json", [](benchpress::context* ctx)
{
for (size_t i = 0; i < ctx->num_iterations(); ++i)
{
std::ifstream input_file("benchmarks/files/numbers/signed_ints.json");
nlohmann::json j;
j << input_file;
}
})
BENCHMARK("parse numbers/unsigned_ints.json", [](benchpress::context* ctx)
{
for (size_t i = 0; i < ctx->num_iterations(); ++i)
{
std::ifstream input_file("benchmarks/files/numbers/unsigned_ints.json");
nlohmann::json j;
j << input_file;
}
})
BENCHMARK("dump jeopardy.json", [](benchpress::context* ctx)
{
std::ifstream input_file("benchmarks/files/jeopardy/jeopardy.json");
nlohmann::json j;
j << input_file;
std::ofstream output_file("jeopardy.dump.json");
ctx->reset_timer();
for (size_t i = 0; i < ctx->num_iterations(); ++i)
{
output_file << j;
}
std::remove("jeopardy.dump.json");
})
BENCHMARK("dump jeopardy.json with indent", [](benchpress::context* ctx)
{
std::ifstream input_file("benchmarks/files/jeopardy/jeopardy.json");
nlohmann::json j;
j << input_file;
std::ofstream output_file("jeopardy.dump.json");
ctx->reset_timer();
for (size_t i = 0; i < ctx->num_iterations(); ++i)
{
output_file << std::setw(4) << j;
}
std::remove("jeopardy.dump.json");
})

View File

@@ -0,0 +1,132 @@
#define BENCHPRESS_CONFIG_MAIN
#include <fstream>
#include <sstream>
#include <benchpress.hpp>
#include <json.hpp>
#include <pthread.h>
#include <thread>
using json = nlohmann::json;
struct StartUp
{
StartUp()
{
#ifndef __llvm__
// pin thread to a single CPU
cpu_set_t cpuset;
pthread_t thread;
thread = pthread_self();
CPU_ZERO(&cpuset);
CPU_SET(std::thread::hardware_concurrency() - 1, &cpuset);
pthread_setaffinity_np(thread, sizeof(cpu_set_t), &cpuset);
#endif
}
};
StartUp startup;
enum class EMode { input, output_no_indent, output_with_indent };
static void bench(benchpress::context& ctx,
const std::string& in_path,
const EMode mode)
{
// using string streams for benchmarking to factor-out cold-cache disk
// access.
#if defined( FROMFILE )
std::ifstream istr;
{
istr.open( in_path, std::ifstream::in );
// read the stream once
json j;
istr >> j;
// clear flags and rewind
istr.clear();
istr.seekg(0);
}
#else
std::stringstream istr;
{
// read file into string stream
std::ifstream input_file(in_path);
istr << input_file.rdbuf();
input_file.close();
// read the stream once
json j;
istr >> j;
// clear flags and rewind
istr.clear();
istr.seekg(0);
}
#endif
switch (mode)
{
// benchmarking input
case EMode::input:
{
ctx.reset_timer();
for (size_t i = 0; i < ctx.num_iterations(); ++i)
{
// clear flags and rewind
istr.clear();
istr.seekg(0);
json j;
istr >> j;
}
break;
}
// benchmarking output
case EMode::output_no_indent:
case EMode::output_with_indent:
{
// create JSON value from input
json j;
istr >> j;
std::stringstream ostr;
ctx.reset_timer();
for (size_t i = 0; i < ctx.num_iterations(); ++i)
{
if (mode == EMode::output_no_indent)
{
ostr << j;
}
else
{
ostr << std::setw(4) << j;
}
// reset data
ostr.str(std::string());
}
break;
}
}
}
#define BENCHMARK_I(mode, title, in_path) \
BENCHMARK((title), [](benchpress::context* ctx) \
{ \
bench(*ctx, (in_path), (mode)); \
})
BENCHMARK_I(EMode::input, "parse jeopardy.json", "files/jeopardy/jeopardy.json");
BENCHMARK_I(EMode::input, "parse canada.json", "files/nativejson-benchmark/canada.json");
BENCHMARK_I(EMode::input, "parse citm_catalog.json", "files/nativejson-benchmark/citm_catalog.json");
BENCHMARK_I(EMode::input, "parse twitter.json", "files/nativejson-benchmark/twitter.json");
BENCHMARK_I(EMode::input, "parse numbers/floats.json", "files/numbers/floats.json");
BENCHMARK_I(EMode::input, "parse numbers/signed_ints.json", "files/numbers/signed_ints.json");
BENCHMARK_I(EMode::input, "parse numbers/unsigned_ints.json", "files/numbers/unsigned_ints.json");
BENCHMARK_I(EMode::output_no_indent, "dump jeopardy.json", "files/jeopardy/jeopardy.json");
BENCHMARK_I(EMode::output_with_indent, "dump jeopardy.json with indent", "files/jeopardy/jeopardy.json");
BENCHMARK_I(EMode::output_no_indent, "dump numbers/floats.json", "files/numbers/floats.json");
BENCHMARK_I(EMode::output_no_indent, "dump numbers/signed_ints.json", "files/numbers/signed_ints.json");

View File

@@ -0,0 +1,158 @@
//
// benchmarks_simple.cpp -- a less complex version of benchmarks.cpp, that better reflects actual performance
//
// For some reason, the complexity of benchmarks.cpp doesn't allow
// the compiler to optimize code using json.hpp effectively. The
// exact same tests, with the use of benchpress and cxxopts produces
// much faster code, at least under g++.
//
#include <fstream>
#include <iostream>
#include <chrono>
#include <list>
#include <tuple>
#include <json.hpp>
using json = nlohmann::json;
enum class EMode { input, output, indent };
static double bench(const EMode mode, size_t iters, const std::string& in_path )
{
// using string streams for benchmarking to factor-out cold-cache disk
// access. Define FROMFILE to use file I/O instead.
#if defined( FROMFILE )
std::ifstream istr;
{
istr.open( in_path, std::ifstream::in );
// read the stream once
json j;
istr >> j;
// clear flags and rewind
istr.clear();
istr.seekg(0);
}
#else
std::stringstream istr;
{
// read file into string stream
std::ifstream input_file(in_path);
istr << input_file.rdbuf();
input_file.close();
// read the stream once
json j;
istr >> j;
// clear flags and rewind
istr.clear();
istr.seekg(0);
}
#endif
double tps = 0;
switch (mode)
{
// benchmarking input
case EMode::input:
{
auto start = std::chrono::system_clock::now();
for (size_t i = 0; i < iters; ++i)
{
// clear flags and rewind
istr.clear();
istr.seekg(0);
json j;
istr >> j;
}
auto ended = std::chrono::system_clock::now();
tps = 1.0 / std::chrono::duration<double>( ended - start ).count();
break;
}
// benchmarking output
case EMode::output:
case EMode::indent:
{
// create JSON value from input
json j;
istr >> j;
std::stringstream ostr;
auto start = std::chrono::system_clock::now();
for (size_t i = 0; i < iters; ++i)
{
if (mode == EMode::indent)
{
ostr << j;
}
else
{
ostr << std::setw(4) << j;
}
// reset data
ostr.str(std::string());
}
auto ended = std::chrono::system_clock::now();
tps = 1.0 / std::chrono::duration<double>( ended - start ).count();
break;
}
}
return tps;
}
template <typename T>
struct average {
T _sum { 0 };
size_t _count { 0 };
T operator+=( const T &val_ ) { _sum += val_; +_count++; return val_; }
operator T() { return _sum / _count; }
};
// Execute each test approximately enough times to get near 1
// transaction per second, and compute the average; a single aggregate
// number that gives a performance metric representing both parsing
// and output.
int main( int, char ** )
{
std::list<std::tuple<std::string, EMode, size_t, std::string>> tests {
{ "parse jeopardy.json", EMode::input, 2, "files/jeopardy/jeopardy.json" },
{ "parse canada.json", EMode::input, 30, "files/nativejson-benchmark/canada.json" },
{ "parse citm_catalog.json", EMode::input, 120, "files/nativejson-benchmark/citm_catalog.json" },
{ "parse twitter.json", EMode::input, 225, "files/nativejson-benchmark/twitter.json" },
{ "parse floats.json", EMode::input, 5, "files/numbers/floats.json" },
{ "parse signed_ints.json", EMode::input, 6, "files/numbers/signed_ints.json" },
{ "parse unsigned_ints.json", EMode::input, 6, "files/numbers/unsigned_ints.json" },
{ "dump jeopardy.json", EMode::output, 5, "files/jeopardy/jeopardy.json" },
{ "dump jeopardy.json w/ind.", EMode::indent, 5, "files/jeopardy/jeopardy.json" },
{ "dump floats.json", EMode::output, 2, "files/numbers/floats.json" },
{ "dump signed_ints.json", EMode::output, 20, "files/numbers/signed_ints.json" },
};
average<double> avg;
for ( auto t : tests ) {
std::string name, path;
EMode mode;
size_t iters;
std::tie(name, mode, iters, path) = t;
auto tps = bench( mode, iters, path );
avg += tps;
std::cout
<< std::left
<< std::setw( 30 ) << name
<< std::right
<< " x " << std::setw( 3 ) << iters
<< std::left
<< " == " << std::setw( 10 ) << tps
<< std::right
<< " TPS, " << std::setw( 8 ) << std::round( tps * 1e6 / iters )
<< " ms/op"
<< std::endl;
}
std::cout << std::setw( 40 ) << "" << std::string( 10, '-' ) << std::endl;
std::cout << std::setw( 40 ) << "" << std::setw( 10 ) << std::left << avg << " TPS Average" << std::endl;
return 0;
}

View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2014 Christopher Gilbert
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

19
benchmarks/thirdparty/cxxopts/LICENSE vendored Normal file
View File

@@ -0,0 +1,19 @@
Copyright (c) 2014 Jarryd Beck
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -1,7 +1,3 @@
@PACKAGE_INIT@
set_and_check(JSON_INCLUDE_DIR "@PACKAGE_JSON_INCLUDE_DESTINATION@")
cmake_policy(PUSH)
cmake_policy(SET CMP0024 OLD)
include(${CMAKE_CURRENT_LIST_DIR}/@JSON_TARGETS_FILENAME@)
cmake_policy(POP)
include("${CMAKE_CURRENT_LIST_DIR}/@NLOHMANN_JSON_TARGETS_EXPORT_NAME@.cmake")
check_required_components("@PROJECT_NAME@")

View File

@@ -1,12 +1,12 @@
# Doxyfile 1.8.9.1
# Doxyfile 1.8.14
#---------------------------------------------------------------------------
# Project related configuration options
#---------------------------------------------------------------------------
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = "JSON for Modern C++"
PROJECT_NUMBER = 2.0.7
PROJECT_BRIEF =
PROJECT_NUMBER = 3.0.0
PROJECT_BRIEF =
PROJECT_LOGO =
OUTPUT_DIRECTORY = .
CREATE_SUBDIRS = NO
@@ -27,10 +27,11 @@ MULTILINE_CPP_IS_BRIEF = NO
INHERIT_DOCS = YES
SEPARATE_MEMBER_PAGES = YES
TAB_SIZE = 4
ALIASES = "complexity=@par Complexity\n"
ALIASES += liveexample{2}="@par Example\n \1 \n @includelineno \2.cpp \n Output (play with this example @htmlinclude \2.link):\n @verbinclude \2.output \n The example code above can be translated with @verbatim g++ -std=c++11 -Isrc doc/examples/\2.cpp -o \2 @endverbatim"
ALIASES += requirement="@par Requirements\n"
ALIASES += exceptionsafety="@par Exception safety\n"
ALIASES = "complexity=@par Complexity\n" \
"liveexample{2}=@par Example\n \1 \n @includelineno \2.cpp \n Output (play with this example @htmlinclude \2.link):\n @verbinclude \2.output \n The <a href= https://github.com/nlohmann/json/blob/develop/doc/examples/\2.cpp>example code</a> above can be translated with @verbatim g++ -std=c++11 -Isrc doc/examples/\2.cpp -o \2 @endverbatim" \
"requirement=@par Requirements\n" \
"exceptionsafety=@par Exception safety\n" \
"iterators=@par Iterator validity\n"
TCL_SUBST =
OPTIMIZE_OUTPUT_FOR_C = NO
OPTIMIZE_OUTPUT_JAVA = NO
@@ -38,12 +39,14 @@ OPTIMIZE_FOR_FORTRAN = NO
OPTIMIZE_OUTPUT_VHDL = NO
EXTENSION_MAPPING =
MARKDOWN_SUPPORT = YES
TOC_INCLUDE_HEADINGS = 0
AUTOLINK_SUPPORT = NO
BUILTIN_STL_SUPPORT = YES
CPP_CLI_SUPPORT = NO
SIP_SUPPORT = NO
IDL_PROPERTY_SUPPORT = YES
DISTRIBUTE_GROUP_DOC = NO
GROUP_NESTED_COMPOUNDS = NO
SUBGROUPING = YES
INLINE_GROUPED_CLASSES = NO
INLINE_SIMPLE_STRUCTS = NO
@@ -97,19 +100,21 @@ WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
WARN_IF_DOC_ERROR = YES
WARN_NO_PARAMDOC = YES
WARN_AS_ERROR = NO
WARN_FORMAT = "$file:$line: $text"
WARN_LOGFILE =
#---------------------------------------------------------------------------
# Configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = ../src/json.hpp index.md
INPUT = ../src/json.hpp \
index.md faq.md
INPUT_ENCODING = UTF-8
FILE_PATTERNS =
RECURSIVE = NO
EXCLUDE =
EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS =
EXCLUDE_SYMBOLS = nlohmann::anonymous_namespace
EXCLUDE_SYMBOLS = nlohmann::detail
EXAMPLE_PATH = examples
EXAMPLE_PATTERNS =
EXAMPLE_RECURSIVE = NO
@@ -131,6 +136,8 @@ REFERENCES_LINK_SOURCE = NO
SOURCE_TOOLTIPS = YES
USE_HTAGS = NO
VERBATIM_HEADERS = NO
CLANG_ASSISTED_PARSING = YES
CLANG_OPTIONS = -std=c++11
#---------------------------------------------------------------------------
# Configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
@@ -152,13 +159,14 @@ HTML_COLORSTYLE_HUE = 220
HTML_COLORSTYLE_SAT = 100
HTML_COLORSTYLE_GAMMA = 80
HTML_TIMESTAMP = YES
HTML_DYNAMIC_MENUS = YES
HTML_DYNAMIC_SECTIONS = YES
HTML_INDEX_NUM_ENTRIES = 100
GENERATE_DOCSET = YES
DOCSET_FEEDNAME = "Doxygen generated docs"
DOCSET_BUNDLE_ID = me.nlohmann.json
DOCSET_PUBLISHER_ID = me.nlohmann
DOCSET_PUBLISHER_NAME = Niels Lohmann
DOCSET_PUBLISHER_NAME = NielsLohmann
GENERATE_HTMLHELP = NO
CHM_FILE =
HHC_LOCATION =
@@ -215,6 +223,7 @@ LATEX_BATCHMODE = NO
LATEX_HIDE_INDICES = NO
LATEX_SOURCE_CODE = NO
LATEX_BIB_STYLE = plain
LATEX_TIMESTAMP = NO
#---------------------------------------------------------------------------
# Configuration options related to the RTF output
#---------------------------------------------------------------------------
@@ -272,7 +281,7 @@ SKIP_FUNCTION_MACROS = YES
# Configuration options related to external references
#---------------------------------------------------------------------------
TAGFILES =
GENERATE_TAGFILE =
GENERATE_TAGFILE = html/nlohmann_json.tag
ALLEXTERNALS = NO
EXTERNAL_GROUPS = YES
EXTERNAL_PAGES = YES
@@ -308,6 +317,7 @@ DOTFILE_DIRS =
MSCFILE_DIRS =
DIAFILE_DIRS =
PLANTUML_JAR_PATH =
PLANTUML_CFG_FILE =
PLANTUML_INCLUDE_PATH =
DOT_GRAPH_MAX_NODES = 50
MAX_DOT_GRAPH_DEPTH = 0

View File

@@ -53,13 +53,17 @@ clean:
# create Doxygen documentation
doxygen: create_output create_links
doxygen
$(SED) -i 's@&lt; ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberFloatType, AllocatorType &gt;@@g' html/*.html
$(SED) -i 's@&lt;&#160;ObjectType,&#160;ArrayType,&#160;StringType,&#160;BooleanType,&#160;NumberIntegerType,&#160;NumberFloatType,&#160;AllocatorType&#160;&gt;@@g' html/*.html
$(SED) -i 's@&lt; ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType &gt;@@g' html/*.html
$(SED) -i 's@< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType >@@g' html/*.html
$(SED) -i 's@&lt; ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberFloatType, AllocatorType, JSONSerializer &gt;@@g' html/*.html
$(SED) -i 's@&lt;&#160;ObjectType,&#160;ArrayType,&#160;StringType,&#160;BooleanType,&#160;NumberIntegerType,&#160;NumberFloatType,&#160;AllocatorType&#160;JSONSerializer&#160;&gt;@@g' html/*.html
$(SED) -i 's@&lt; ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer &gt;@@g' html/*.html
$(SED) -i 's@< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer >@@g' html/*.html
$(SED) -i 's@&lt;&#160;ObjectType,&#160;ArrayType,&#160;StringType,&#160;BooleanType,&#160;NumberIntegerType,&#160;NumberUnsignedType,&#160;NumberFloatType,&#160;AllocatorType&#160;JSONSerializer&#160;&gt;@@g' html/*.html
$(SED) -i 's@template&lt;template&lt; typename U, typename V, typename... Args &gt; class ObjectType = std::map, template&lt; typename U, typename... Args &gt; class ArrayType = std::vector, class StringType = std::string, class BooleanType = bool, class NumberIntegerType = std::int64_t, class NumberUnsignedType = std::uint64_t, class NumberFloatType = double, template&lt; typename U &gt; class AllocatorType = std::allocator, template&lt; typename T, typename SFINAE=void &gt; class JSONSerializer = adl_serializer&gt;@@g' html/*.html
$(SED) -i 's@&lt; ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer &gt;@@g' html/*.html
$(SED) -i 's@&lt;&#160;ObjectType,&#160;ArrayType,&#160;StringType,&#160;BooleanType,&#160;NumberIntegerType,&#160;NumberUnsignedType,&#160;NumberFloatType,&#160;AllocatorType,&#160;JSONSerializer&#160;&gt;@@g' html/*.html
upload: clean doxygen check_output
cd html ; ../scripts/git-update-ghpages nlohmann/json
scripts/git-update-ghpages nlohmann/json html
rm -fr html
open http://nlohmann.github.io/json/

BIN
doc/avatars.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 530 KiB

View File

@@ -1,4 +1,5 @@
#include <json.hpp>
#include <iostream>
#include "json.hpp"
using json = nlohmann::json;
@@ -29,7 +30,8 @@ int main()
j["new"]["key"]["value"] = {"another", "list"};
// count elements
j["size"] = j.size();
auto s = j.size();
j["size"] = s;
// pretty print with indent of 4 spaces
std::cout << std::setw(4) << j << '\n';

View File

@@ -1 +1 @@
<a target="_blank" href="http://melpon.org/wandbox/permlink/fsf5FqYe6GoX68W6"><b>online</b></a>
<a target="_blank" href="https://wandbox.org/permlink/TZS6TQdqmEUcN8WW"><b>online</b></a>

View File

@@ -23,5 +23,5 @@
"value": 42.99
},
"pi": 3.141,
"size": 9
"size": 8
}

View File

@@ -1,4 +1,5 @@
#include <json.hpp>
#include <iostream>
#include "json.hpp"
using json = nlohmann::json;

View File

@@ -1 +1 @@
<a target="_blank" href="http://melpon.org/wandbox/permlink/1fsm4gI55p83DOwU"><b>online</b></a>
<a target="_blank" href="https://wandbox.org/permlink/jKwlQd7pFg6UcIN5"><b>online</b></a>

View File

@@ -1,4 +1,5 @@
#include <json.hpp>
#include <iostream>
#include "json.hpp"
using json = nlohmann::json;
@@ -8,7 +9,7 @@ int main()
json object =
{
{"the good", "il buono"},
{"the bad", "il cativo"},
{"the bad", "il cattivo"},
{"the ugly", "il brutto"}
};
@@ -21,13 +22,27 @@ int main()
// output changed array
std::cout << object << '\n';
// try to write at a nonexisting key
// exception type_error.304
try
{
// use at() on a non-object type
json str = "I am a string";
str.at("the good") = "Another string";
}
catch (json::type_error& e)
{
std::cout << e.what() << '\n';
}
// exception out_of_range.401
try
{
// try to write at a nonexisting key
object.at("the fast") = "il rapido";
}
catch (std::out_of_range& e)
catch (json::out_of_range& e)
{
std::cout << "out of range: " << e.what() << '\n';
std::cout << e.what() << '\n';
}
}

View File

@@ -1 +1 @@
<a target="_blank" href="http://melpon.org/wandbox/permlink/rsnwWxpDjmtRRSzb"><b>online</b></a>
<a target="_blank" href="https://wandbox.org/permlink/FR2yYACZpx0k3Rzp"><b>online</b></a>

View File

@@ -1,3 +1,4 @@
"il brutto"
{"the bad":"il cattivo","the good":"il buono","the ugly":"il brutto"}
out of range: key 'the fast' not found
[json.exception.type_error.304] cannot use at() with string
[json.exception.out_of_range.403] key 'the fast' not found

View File

@@ -1,4 +1,5 @@
#include <json.hpp>
#include <iostream>
#include "json.hpp"
using json = nlohmann::json;
@@ -8,19 +9,33 @@ int main()
json object =
{
{"the good", "il buono"},
{"the bad", "il cativo"},
{"the bad", "il cattivo"},
{"the ugly", "il brutto"}
};
// output element with key "the ugly"
std::cout << object.at("the ugly") << '\n';
// try to read from a nonexisting key
// exception type_error.304
try
{
// use at() on a non-object type
const json str = "I am a string";
std::cout << str.at("the good") << '\n';
}
catch (json::type_error& e)
{
std::cout << e.what() << '\n';
}
// exception out_of_range.401
try
{
// try to read from a nonexisting key
std::cout << object.at("the fast") << '\n';
}
catch (std::out_of_range)
catch (json::out_of_range)
{
std::cout << "out of range" << '\n';
}

View File

@@ -1 +1 @@
<a target="_blank" href="http://melpon.org/wandbox/permlink/aeoZrnhnb3HKClCY"><b>online</b></a>
<a target="_blank" href="https://wandbox.org/permlink/aeF8S2D89A8lfVx1"><b>online</b></a>

View File

@@ -1,2 +1,3 @@
"il brutto"
[json.exception.type_error.304] cannot use at() with string
out of range

View File

@@ -1,4 +1,5 @@
#include <json.hpp>
#include <iostream>
#include "json.hpp"
using json = nlohmann::json;
@@ -16,13 +17,27 @@ int main()
// output changed array
std::cout << array << '\n';
// try to write beyond the array limit
// exception type_error.304
try
{
// use at() on a non-array type
json str = "I am a string";
str.at(0) = "Another string";
}
catch (json::type_error& e)
{
std::cout << e.what() << '\n';
}
// exception out_of_range.401
try
{
// try to write beyond the array limit
array.at(5) = "sixth";
}
catch (std::out_of_range& e)
catch (json::out_of_range& e)
{
std::cout << "out of range: " << e.what() << '\n';
std::cout << e.what() << '\n';
}
}

View File

@@ -1 +1 @@
<a target="_blank" href="http://melpon.org/wandbox/permlink/R7z2SB2rMdFQ9XtR"><b>online</b></a>
<a target="_blank" href="https://wandbox.org/permlink/GmNdQadc8cWDzYpn"><b>online</b></a>

View File

@@ -1,3 +1,4 @@
"third"
["first","second","third","fourth"]
out of range: array index 5 is out of range
[json.exception.type_error.304] cannot use at() with string
[json.exception.out_of_range.401] array index 5 is out of range

View File

@@ -1,22 +1,37 @@
#include <json.hpp>
#include <iostream>
#include "json.hpp"
using json = nlohmann::json;
int main()
{
// create JSON array
json array = {"first", "2nd", "third", "fourth"};
const json array = {"first", "2nd", "third", "fourth"};
// output element at index 2 (third element)
std::cout << array.at(2) << '\n';
// try to read beyond the array limit
// exception type_error.304
try
{
// use at() on a non-array type
const json str = "I am a string";
std::cout << str.at(0) << '\n';
}
catch (json::type_error& e)
{
std::cout << e.what() << '\n';
}
// exception out_of_range.401
try
{
// try to read beyond the array limit
std::cout << array.at(5) << '\n';
}
catch (std::out_of_range)
catch (json::out_of_range& e)
{
std::cout << "out of range" << '\n';
std::cout << e.what() << '\n';
}
}

View File

@@ -1 +1 @@
<a target="_blank" href="http://melpon.org/wandbox/permlink/L1bMeiN6nYm7JrvA"><b>online</b></a>
<a target="_blank" href="https://wandbox.org/permlink/zLkp80JFsKEuPd1t"><b>online</b></a>

View File

@@ -1,2 +1,3 @@
"third"
out of range
[json.exception.type_error.304] cannot use at() with string
[json.exception.out_of_range.401] array index 5 is out of range

View File

@@ -1,4 +1,5 @@
#include <json.hpp>
#include <iostream>
#include "json.hpp"
using json = nlohmann::json;
@@ -32,4 +33,60 @@ int main()
j.at("/array/1"_json_pointer) = 21;
// output the changed array
std::cout << j["array"] << '\n';
// out_of_range.106
try
{
// try to use an array index with leading '0'
json::reference ref = j.at("/array/01"_json_pointer);
}
catch (json::parse_error& e)
{
std::cout << e.what() << '\n';
}
// out_of_range.109
try
{
// try to use an array index that is not a number
json::reference ref = j.at("/array/one"_json_pointer);
}
catch (json::parse_error& e)
{
std::cout << e.what() << '\n';
}
// out_of_range.401
try
{
// try to use a an invalid array index
json::reference ref = j.at("/array/4"_json_pointer);
}
catch (json::out_of_range& e)
{
std::cout << e.what() << '\n';
}
// out_of_range.402
try
{
// try to use the array index '-'
json::reference ref = j.at("/array/-"_json_pointer);
}
catch (json::out_of_range& e)
{
std::cout << e.what() << '\n';
}
// out_of_range.404
try
{
// try to use a JSON pointer that cannot be resolved
json::reference ref = j.at("/number/foo"_json_pointer);
}
catch (json::out_of_range& e)
{
std::cout << e.what() << '\n';
}
}

View File

@@ -1 +1 @@
<a target="_blank" href="http://melpon.org/wandbox/permlink/NDSjglHZIjIZ0Uxg"><b>online</b></a>
<a target="_blank" href="https://wandbox.org/permlink/mlj2WqOtwBidvuJx"><b>online</b></a>

View File

@@ -4,3 +4,8 @@
2
"bar"
[1,21]
[json.exception.parse_error.106] parse error: array index '01' must not begin with '0'
[json.exception.parse_error.109] parse error: array index 'one' is not a number
[json.exception.out_of_range.401] array index 4 is out of range
[json.exception.out_of_range.402] array index '-' (2) is out of range
[json.exception.out_of_range.404] unresolved reference token 'foo'

View File

@@ -1,11 +1,12 @@
#include <json.hpp>
#include <iostream>
#include "json.hpp"
using json = nlohmann::json;
int main()
{
// create a JSON value
json j =
const json j =
{
{"number", 1}, {"string", "foo"}, {"array", {1, 2}}
};
@@ -20,4 +21,48 @@ int main()
std::cout << j.at("/array"_json_pointer) << '\n';
// output element with JSON pointer "/array/1"
std::cout << j.at("/array/1"_json_pointer) << '\n';
// out_of_range.109
try
{
// try to use an array index that is not a number
json::const_reference ref = j.at("/array/one"_json_pointer);
}
catch (json::parse_error& e)
{
std::cout << e.what() << '\n';
}
// out_of_range.401
try
{
// try to use a an invalid array index
json::const_reference ref = j.at("/array/4"_json_pointer);
}
catch (json::out_of_range& e)
{
std::cout << e.what() << '\n';
}
// out_of_range.402
try
{
// try to use the array index '-'
json::const_reference ref = j.at("/array/-"_json_pointer);
}
catch (json::out_of_range& e)
{
std::cout << e.what() << '\n';
}
// out_of_range.404
try
{
// try to use a JSON pointer that cannot be resolved
json::const_reference ref = j.at("/number/foo"_json_pointer);
}
catch (json::out_of_range& e)
{
std::cout << e.what() << '\n';
}
}

View File

@@ -1 +1 @@
<a target="_blank" href="http://melpon.org/wandbox/permlink/OuLYiMJ3pgyOHupb"><b>online</b></a>
<a target="_blank" href="https://wandbox.org/permlink/vHKlyYl9DwaUO9UN"><b>online</b></a>

View File

@@ -2,3 +2,7 @@
"foo"
[1,2]
2
[json.exception.parse_error.109] parse error: array index 'one' is not a number
[json.exception.out_of_range.401] array index 4 is out of range
[json.exception.out_of_range.402] array index '-' (2) is out of range
[json.exception.out_of_range.404] unresolved reference token 'foo'

View File

@@ -1,11 +1,11 @@
#include <json.hpp>
#include <iostream>
#include "json.hpp"
using json = nlohmann::json;
int main()
{
// create JSON values
json j_null;
json j_boolean = true;
json j_number_integer = 17;
json j_number_float = 23.42;
@@ -16,7 +16,6 @@ int main()
json j_string = "Hello, world";
// call back()
//std::cout << j_null.back() << '\n'; // would throw
std::cout << j_boolean.back() << '\n';
std::cout << j_number_integer.back() << '\n';
std::cout << j_number_float.back() << '\n';
@@ -25,4 +24,15 @@ int main()
std::cout << j_array.back() << '\n';
//std::cout << j_array_empty.back() << '\n'; // undefined behavior
std::cout << j_string.back() << '\n';
// back() called on a null value
try
{
json j_null;
j_null.back();
}
catch (json::invalid_iterator& e)
{
std::cout << e.what() << '\n';
}
}

View File

@@ -1 +1 @@
<a target="_blank" href="http://melpon.org/wandbox/permlink/nPVnBcHf8nrNpGOJ"><b>online</b></a>
<a target="_blank" href="https://wandbox.org/permlink/VXTfLJQl9x7NaHrI"><b>online</b></a>

View File

@@ -4,3 +4,4 @@ true
2
16
"Hello, world"
[json.exception.invalid_iterator.214] cannot get value

View File

@@ -1,58 +0,0 @@
#include <json.hpp>
#include <deque>
#include <list>
#include <forward_list>
#include <set>
#include <unordered_set>
using json = nlohmann::json;
int main()
{
// create an array from std::vector
std::vector<int> c_vector {1, 2, 3, 4};
json j_vec(c_vector);
// create an array from std::deque
std::deque<double> c_deque {1.2, 2.3, 3.4, 5.6};
json j_deque(c_deque);
// create an array from std::list
std::list<bool> c_list {true, true, false, true};
json j_list(c_list);
// create an array from std::forward_list
std::forward_list<int64_t> c_flist {12345678909876, 23456789098765, 34567890987654, 45678909876543};
json j_flist(c_flist);
// create an array from std::array
std::array<unsigned long, 4> c_array {{1, 2, 3, 4}};
json j_array(c_array);
// create an array from std::set
std::set<std::string> c_set {"one", "two", "three", "four", "one"};
json j_set(c_set); // only one entry for "one" is used
// create an array from std::unordered_set
std::unordered_set<std::string> c_uset {"one", "two", "three", "four", "one"};
json j_uset(c_uset); // only one entry for "one" is used
// create an array from std::multiset
std::multiset<std::string> c_mset {"one", "two", "one", "four"};
json j_mset(c_mset); // both entries for "one" are used
// create an array from std::unordered_multiset
std::unordered_multiset<std::string> c_umset {"one", "two", "one", "four"};
json j_umset(c_umset); // both entries for "one" are used
// serialize the JSON arrays
std::cout << j_vec << '\n';
std::cout << j_deque << '\n';
std::cout << j_list << '\n';
std::cout << j_flist << '\n';
std::cout << j_array << '\n';
std::cout << j_set << '\n';
std::cout << j_uset << '\n';
std::cout << j_mset << '\n';
std::cout << j_umset << '\n';
}

View File

@@ -1 +0,0 @@
<a target="_blank" href="http://melpon.org/wandbox/permlink/3BIhBw91FUVuHE1D"><b>online</b></a>

View File

@@ -1,9 +0,0 @@
[1,2,3,4]
[1.2,2.3,3.4,5.6]
[true,true,false,true]
[12345678909876,23456789098765,34567890987654,45678909876543]
[1,2,3,4]
["four","one","three","two"]
["four","three","two","one"]
["four","one","one","two"]
["four","two","one","one"]

View File

@@ -1,27 +0,0 @@
#include <json.hpp>
using json = nlohmann::json;
int main()
{
// create values of different integer types
short n42 = 42;
int n23 = 23;
long n1024 = 1024;
int_least32_t n17 = 17;
uint8_t n8 = 8;
// create JSON numbers
json j42(n42);
json j23(n23);
json j1024(n1024);
json j17(n17);
json j8(n8);
// serialize the JSON numbers
std::cout << j42 << '\n';
std::cout << j23 << '\n';
std::cout << j1024 << '\n';
std::cout << j17 << '\n';
std::cout << j8 << '\n';
}

View File

@@ -1 +0,0 @@
<a target="_blank" href="http://melpon.org/wandbox/permlink/PcMzhcu2RpD7KSwr"><b>online</b></a>

View File

@@ -1,5 +0,0 @@
42
23
1024
17
8

View File

@@ -1,21 +0,0 @@
#include <json.hpp>
using json = nlohmann::json;
int main()
{
// create values of different floating-point types
float f42 = 42.23;
float f_nan = 1.0f / 0.0f;
double f23 = 23.42;
// create JSON numbers
json j42(f42);
json j_nan(f_nan);
json j23(f23);
// serialize the JSON numbers
std::cout << j42 << '\n';
std::cout << j_nan << '\n';
std::cout << j23 << '\n';
}

View File

@@ -1 +0,0 @@
<a target="_blank" href="http://melpon.org/wandbox/permlink/2TCYWSrOxnR05AZI"><b>online</b></a>

View File

@@ -1,3 +0,0 @@
42.2299995422363
null
23.42

View File

@@ -1,41 +0,0 @@
#include <json.hpp>
#include <unordered_map>
using json = nlohmann::json;
int main()
{
// create an object from std::map
std::map<std::string, int> c_map
{
{"one", 1}, {"two", 2}, {"three", 3}
};
json j_map(c_map);
// create an object from std::unordered_map
std::unordered_map<const char*, double> c_umap
{
{"one", 1.2}, {"two", 2.3}, {"three", 3.4}
};
json j_umap(c_umap);
// create an object from std::multimap
std::multimap<std::string, bool> c_mmap
{
{"one", true}, {"two", true}, {"three", false}, {"three", true}
};
json j_mmap(c_mmap); // only one entry for key "three" is used
// create an object from std::unordered_multimap
std::unordered_multimap<std::string, bool> c_ummap
{
{"one", true}, {"two", true}, {"three", false}, {"three", true}
};
json j_ummap(c_ummap); // only one entry for key "three" is used
// serialize the JSON objects
std::cout << j_map << '\n';
std::cout << j_umap << '\n';
std::cout << j_mmap << '\n';
std::cout << j_ummap << '\n';
}

View File

@@ -1 +0,0 @@
<a target="_blank" href="http://melpon.org/wandbox/permlink/JzLCMcSXNsh4uVWa"><b>online</b></a>

View File

@@ -1,4 +0,0 @@
{"one":1,"three":3,"two":2}
{"one":1.2,"three":3.4,"two":2.3}
{"one":true,"three":false,"two":true}
{"one":true,"three":false,"two":true}

View File

@@ -1,15 +0,0 @@
#include <json.hpp>
using json = nlohmann::json;
int main()
{
// create a string value
std::string s = "The quick brown fox jumps over the lazy dog.";
// create a JSON string value
json j = s;
// serialize the JSON string
std::cout << j << '\n';
}

View File

@@ -1 +0,0 @@
<a target="_blank" href="http://melpon.org/wandbox/permlink/b9hbCY8zfOiTOuoK"><b>online</b></a>

View File

@@ -1 +0,0 @@
"The quick brown fox jumps over the lazy dog."

View File

@@ -0,0 +1,218 @@
#include <iostream>
#include <deque>
#include <list>
#include <forward_list>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <valarray>
#include "json.hpp"
using json = nlohmann::json;
int main()
{
// ============
// object types
// ============
// create an object from an object_t value
json::object_t object_value = { {"one", 1}, {"two", 2} };
json j_object_t(object_value);
// create an object from std::map
std::map<std::string, int> c_map
{
{"one", 1}, {"two", 2}, {"three", 3}
};
json j_map(c_map);
// create an object from std::unordered_map
std::unordered_map<const char*, double> c_umap
{
{"one", 1.2}, {"two", 2.3}, {"three", 3.4}
};
json j_umap(c_umap);
// create an object from std::multimap
std::multimap<std::string, bool> c_mmap
{
{"one", true}, {"two", true}, {"three", false}, {"three", true}
};
json j_mmap(c_mmap); // only one entry for key "three" is used
// create an object from std::unordered_multimap
std::unordered_multimap<std::string, bool> c_ummap
{
{"one", true}, {"two", true}, {"three", false}, {"three", true}
};
json j_ummap(c_ummap); // only one entry for key "three" is used
// serialize the JSON objects
std::cout << j_object_t << '\n';
std::cout << j_map << '\n';
std::cout << j_umap << '\n';
std::cout << j_mmap << '\n';
std::cout << j_ummap << "\n\n";
// ===========
// array types
// ===========
// create an array from an array_t value
json::array_t array_value = {"one", "two", 3, 4.5, false};
json j_array_t(array_value);
// create an array from std::vector
std::vector<int> c_vector {1, 2, 3, 4};
json j_vec(c_vector);
// create an array from std::valarray
std::valarray<short> c_valarray {10, 9, 8, 7};
json j_valarray(c_valarray);
// create an array from std::deque
std::deque<double> c_deque {1.2, 2.3, 3.4, 5.6};
json j_deque(c_deque);
// create an array from std::list
std::list<bool> c_list {true, true, false, true};
json j_list(c_list);
// create an array from std::forward_list
std::forward_list<int64_t> c_flist {12345678909876, 23456789098765, 34567890987654, 45678909876543};
json j_flist(c_flist);
// create an array from std::array
std::array<unsigned long, 4> c_array {{1, 2, 3, 4}};
json j_array(c_array);
// create an array from std::set
std::set<std::string> c_set {"one", "two", "three", "four", "one"};
json j_set(c_set); // only one entry for "one" is used
// create an array from std::unordered_set
std::unordered_set<std::string> c_uset {"one", "two", "three", "four", "one"};
json j_uset(c_uset); // only one entry for "one" is used
// create an array from std::multiset
std::multiset<std::string> c_mset {"one", "two", "one", "four"};
json j_mset(c_mset); // both entries for "one" are used
// create an array from std::unordered_multiset
std::unordered_multiset<std::string> c_umset {"one", "two", "one", "four"};
json j_umset(c_umset); // both entries for "one" are used
// serialize the JSON arrays
std::cout << j_array_t << '\n';
std::cout << j_vec << '\n';
std::cout << j_valarray << '\n';
std::cout << j_deque << '\n';
std::cout << j_list << '\n';
std::cout << j_flist << '\n';
std::cout << j_array << '\n';
std::cout << j_set << '\n';
std::cout << j_uset << '\n';
std::cout << j_mset << '\n';
std::cout << j_umset << "\n\n";
// ============
// string types
// ============
// create string from a string_t value
json::string_t string_value = "The quick brown fox jumps over the lazy dog.";
json j_string_t(string_value);
// create a JSON string directly from a string literal
json j_string_literal("The quick brown fox jumps over the lazy dog.");
// create string from std::string
std::string s_stdstring = "The quick brown fox jumps over the lazy dog.";
json j_stdstring(s_stdstring);
// serialize the JSON strings
std::cout << j_string_t << '\n';
std::cout << j_string_literal << '\n';
std::cout << j_stdstring << "\n\n";
// ============
// number types
// ============
// create a JSON number from number_integer_t
json::number_integer_t value_integer_t = -42;
json j_integer_t(value_integer_t);
// create a JSON number from number_unsigned_t
json::number_integer_t value_unsigned_t = 17;
json j_unsigned_t(value_unsigned_t);
// create a JSON number from an anonymous enum
enum { enum_value = 17 };
json j_enum(enum_value);
// create values of different integer types
short n_short = 42;
int n_int = -23;
long n_long = 1024;
int_least32_t n_int_least32_t = -17;
uint8_t n_uint8_t = 8;
// create (integer) JSON numbers
json j_short(n_short);
json j_int(n_int);
json j_long(n_long);
json j_int_least32_t(n_int_least32_t);
json j_uint8_t(n_uint8_t);
// create values of different floating-point types
json::number_float_t v_ok = 3.141592653589793;
json::number_float_t v_nan = NAN;
json::number_float_t v_infinity = INFINITY;
// create values of different floating-point types
float n_float = 42.23;
float n_float_nan = 1.0f / 0.0f;
double n_double = 23.42;
// create (floating point) JSON numbers
json j_ok(v_ok);
json j_nan(v_nan);
json j_infinity(v_infinity);
json j_float(n_float);
json j_float_nan(n_float_nan);
json j_double(n_double);
// serialize the JSON numbers
std::cout << j_integer_t << '\n';
std::cout << j_unsigned_t << '\n';
std::cout << j_enum << '\n';
std::cout << j_short << '\n';
std::cout << j_int << '\n';
std::cout << j_long << '\n';
std::cout << j_int_least32_t << '\n';
std::cout << j_uint8_t << '\n';
std::cout << j_ok << '\n';
std::cout << j_nan << '\n';
std::cout << j_infinity << '\n';
std::cout << j_float << '\n';
std::cout << j_float_nan << '\n';
std::cout << j_double << "\n\n";
// =============
// boolean types
// =============
// create boolean values
json j_truth = true;
json j_falsity = false;
// serialize the JSON booleans
std::cout << j_truth << '\n';
std::cout << j_falsity << '\n';
}

View File

@@ -0,0 +1 @@
<a target="_blank" href="https://wandbox.org/permlink/s7Ecy7hDYSmUWHyx"><b>online</b></a>

View File

@@ -0,0 +1,39 @@
{"one":1,"two":2}
{"one":1,"three":3,"two":2}
{"one":1.2,"three":3.4,"two":2.3}
{"one":true,"three":false,"two":true}
{"one":true,"three":false,"two":true}
["one","two",3,4.5,false]
[1,2,3,4]
[10,9,8,7]
[1.2,2.3,3.4,5.6]
[true,true,false,true]
[12345678909876,23456789098765,34567890987654,45678909876543]
[1,2,3,4]
["four","one","three","two"]
["four","three","two","one"]
["four","one","one","two"]
["four","two","one","one"]
"The quick brown fox jumps over the lazy dog."
"The quick brown fox jumps over the lazy dog."
"The quick brown fox jumps over the lazy dog."
-42
17
17
42
-23
1024
-17
8
3.14159265358979
null
null
42.2299995422363
null
23.42
true
false

View File

@@ -1,4 +1,5 @@
#include <json.hpp>
#include <iostream>
#include "json.hpp"
using json = nlohmann::json;
@@ -18,4 +19,14 @@ int main()
std::cout << j_array_range << '\n';
std::cout << j_number_range << '\n';
std::cout << j_object_range << '\n';
// example for an exception
try
{
json j_invalid(j_number.begin() + 1, j_number.end());
}
catch (json::invalid_iterator& e)
{
std::cout << e.what() << '\n';
}
}

View File

@@ -1 +1 @@
<a target="_blank" href="http://melpon.org/wandbox/permlink/nKF1QcieoCHm6Lez"><b>online</b></a>
<a target="_blank" href="https://wandbox.org/permlink/qpFQRSCnP6iVb3dF"><b>online</b></a>

View File

@@ -1,3 +1,4 @@
["bravo","charly"]
42
{"one":"eins"}
[json.exception.invalid_iterator.204] iterators out of range

View File

@@ -1,15 +0,0 @@
#include <json.hpp>
using json = nlohmann::json;
int main()
{
// create an array_t value
json::array_t value = {"one", "two", 3, 4.5, false};
// create a JSON array from the value
json j(value);
// serialize the JSON array
std::cout << j << '\n';
}

View File

@@ -1 +0,0 @@
<a target="_blank" href="http://melpon.org/wandbox/permlink/dTbSNAvl6TqrMEAn"><b>online</b></a>

View File

@@ -1 +0,0 @@
["one","two",3,4.5,false]

View File

@@ -1,4 +1,5 @@
#include <json.hpp>
#include <iostream>
#include "json.hpp"
using json = nlohmann::json;

View File

@@ -1 +1 @@
<a target="_blank" href="http://melpon.org/wandbox/permlink/6Qfn12BDzb3vqO5p"><b>online</b></a>
<a target="_blank" href="https://wandbox.org/permlink/hRrKgHP2a0zgdxJ1"><b>online</b></a>

View File

@@ -1,14 +0,0 @@
#include <json.hpp>
using json = nlohmann::json;
int main()
{
// create boolean values
json j_truth = true;
json j_falsity = false;
// serialize the JSON booleans
std::cout << j_truth << '\n';
std::cout << j_falsity << '\n';
}

View File

@@ -1 +0,0 @@
<a target="_blank" href="http://melpon.org/wandbox/permlink/VmVl9pyrQp8LyOnU"><b>online</b></a>

View File

@@ -1,2 +0,0 @@
true
false

View File

@@ -1,15 +0,0 @@
#include <json.hpp>
using json = nlohmann::json;
int main()
{
// an anonymous enum
enum { t = 17 };
// create a JSON number from the enum
json j(t);
// serialize the JSON numbers
std::cout << j << '\n';
}

View File

@@ -1 +0,0 @@
<a target="_blank" href="http://melpon.org/wandbox/permlink/3xQ1qy7BT9OrSSCo"><b>online</b></a>

View File

@@ -1 +0,0 @@
17

View File

@@ -1,4 +1,5 @@
#include <json.hpp>
#include <iostream>
#include "json.hpp"
using json = nlohmann::json;

View File

@@ -1 +1 @@
<a target="_blank" href="http://melpon.org/wandbox/permlink/iWYvmlA4qQmtvACX"><b>online</b></a>
<a target="_blank" href="https://wandbox.org/permlink/4p0zccjr9gUI65H2"><b>online</b></a>

View File

@@ -1,57 +0,0 @@
#include <json.hpp>
using json = nlohmann::json;
int main()
{
// a JSON text
auto text = R"(
{
"Image": {
"Width": 800,
"Height": 600,
"Title": "View from 15th Floor",
"Thumbnail": {
"Url": "http://www.example.com/image/481989943",
"Height": 125,
"Width": 100
},
"Animated" : false,
"IDs": [116, 943, 234, 38793]
}
}
)";
// fill a stream with JSON text
std::stringstream ss;
ss << text;
// create JSON from stream
json j_complete(ss); // deprecated!
// shall be replaced by: json j_complete = json::parse(ss);
std::cout << std::setw(4) << j_complete << "\n\n";
// define parser callback
json::parser_callback_t cb = [](int depth, json::parse_event_t event, json & parsed)
{
// skip object elements with key "Thumbnail"
if (event == json::parse_event_t::key and parsed == json("Thumbnail"))
{
return false;
}
else
{
return true;
}
};
// fill a stream with JSON text
ss.clear();
ss << text;
// create JSON from stream (with callback)
json j_filtered(ss, cb);
// shall be replaced by: json j_filtered = json::parse(ss, cb);
std::cout << std::setw(4) << j_filtered << '\n';
}

View File

@@ -1 +0,0 @@
<a target="_blank" href="http://melpon.org/wandbox/permlink/R6dzpKXlxrttShf7"><b>online</b></a>

View File

@@ -1,34 +0,0 @@
{
"Image": {
"Animated": false,
"Height": 600,
"IDs": [
116,
943,
234,
38793
],
"Thumbnail": {
"Height": 125,
"Url": "http://www.example.com/image/481989943",
"Width": 100
},
"Title": "View from 15th Floor",
"Width": 800
}
}
{
"Image": {
"Animated": false,
"Height": 600,
"IDs": [
116,
943,
234,
38793
],
"Title": "View from 15th Floor",
"Width": 800
}
}

View File

@@ -1,4 +1,5 @@
#include <json.hpp>
#include <iostream>
#include "json.hpp"
using json = nlohmann::json;

View File

@@ -1 +1 @@
<a target="_blank" href="http://melpon.org/wandbox/permlink/iZzzxEpB7tbhz0cx"><b>online</b></a>
<a target="_blank" href="https://wandbox.org/permlink/XyDVBlGsU1DHpRl9"><b>online</b></a>

View File

@@ -1,4 +1,5 @@
#include <json.hpp>
#include <iostream>
#include "json.hpp"
using json = nlohmann::json;

View File

@@ -1 +1 @@
<a target="_blank" href="http://melpon.org/wandbox/permlink/CaDlatv1uXhQiu7o"><b>online</b></a>
<a target="_blank" href="https://wandbox.org/permlink/Z1uToOcza9ALJxNU"><b>online</b></a>

View File

@@ -1,4 +1,5 @@
#include <json.hpp>
#include <iostream>
#include "json.hpp"
using json = nlohmann::json;

View File

@@ -1 +1 @@
<a target="_blank" href="http://melpon.org/wandbox/permlink/9Tvfs2dJBW8m8ihA"><b>online</b></a>
<a target="_blank" href="https://wandbox.org/permlink/JQUGGZT8qZyQsHRv"><b>online</b></a>

View File

@@ -1,21 +0,0 @@
#include <json.hpp>
using json = nlohmann::json;
int main()
{
// create values of different floating-point types
json::number_float_t v_ok = 3.141592653589793;
json::number_float_t v_nan = NAN;
json::number_float_t v_infinity = INFINITY;
// create JSON numbers
json j_ok(v_ok);
json j_nan(v_nan);
json j_infinity(v_infinity);
// serialize the JSON numbers
std::cout << j_ok << '\n';
std::cout << j_nan << '\n';
std::cout << j_infinity << '\n';
}

View File

@@ -1 +0,0 @@
<a target="_blank" href="http://melpon.org/wandbox/permlink/OTgOxjIAKFvxpFdm"><b>online</b></a>

View File

@@ -1,3 +0,0 @@
3.14159265358979
null
null

View File

@@ -1,14 +0,0 @@
#include <json.hpp>
using json = nlohmann::json;
int main()
{
// create a JSON number from number_integer_t
json::number_integer_t value = 42;
json j(value);
// serialize the JSON numbers
std::cout << j << '\n';
}

Some files were not shown because too many files have changed in this diff Show More