Commit graph

871 commits

Author SHA1 Message Date
Niels Lohmann
1b54d4a5aa
Merge branch 'develop' into feature/ubjson 2018-01-14 10:10:56 +01:00
Niels Lohmann
3a7585e738
added more tests 2018-01-10 22:47:07 +01:00
Niels Lohmann
965a70e38d
🔨 optimized output format 2018-01-10 11:22:19 +01:00
Niels Lohmann
fb1154c237
🚧 debug 2018-01-08 21:26:41 +01:00
Niels Lohmann
97e0d20ce9
🚧 debug 2018-01-08 21:16:20 +01:00
Niels Lohmann
ebf28a26ee
🚧 another try 2018-01-08 20:49:02 +01:00
Théo DELRIEU
7e4ee23f40
add single_header CMake target 2018-01-08 20:09:43 +01:00
Niels Lohmann
3d7658da89
🚧 working on AppVeyor's errors 2018-01-08 19:48:18 +01:00
Niels Lohmann
126ce2e56c
🚧 further UBJSON 2018-01-08 18:54:17 +01:00
Niels Lohmann
c9938ea838
🚧 started UBJSON implementation 2018-01-07 22:09:12 +01:00
Niels Lohmann
15b6421d07
added UTF-8 decoder capability and stress test
As described in http://www.cl.cam.ac.uk/~mgk25/ucs/examples/UTF-8-test.txt; Markus Kuhn <http://www.cl.cam.ac.uk/~mgk25/> - 2015-08-28 - CC BY 4.0
2018-01-05 23:26:22 +01:00
Niels Lohmann
78f8f837e6
added items() function #874 2018-01-05 18:34:10 +01:00
Niels Lohmann
92484f0caf
🔖 set version to 3.0.1 2017-12-29 18:31:13 +01:00
Niels Lohmann
ebc6849b71
added test for #894 2017-12-29 16:53:04 +01:00
Niels Lohmann
3b3b6e8e69
🚑 fix for #894
- Implemented "copy" in terms of "add".
- Added check for JSON Pointer array indices to make sure the complete reference token was processed.
- Added test suite from https://github.com/json-patch/json-patch-tests
2017-12-28 13:52:23 +01:00
Niels Lohmann
9e3c4ad11f
🔖 set version to 3.0.0 2017-12-17 08:31:18 +01:00
Niels Lohmann
9a51fb4da2
🚨 fixed some warnings 2017-12-16 22:19:30 +01:00
Niels Lohmann
4c871c58f8
re-added tests for algorithms 2017-12-16 11:16:34 +01:00
Niels Lohmann
c6e7eae394
implemented JSON Merge Patch (RFC 7396)
SQLite's json1 extension (https://www.sqlite.org/json1.html) supports JSON Merge Patch (https://tools.ietf.org/html/rfc7396). As the implementation is trivial and we already support JSON Patch, I think this could be a nice extension to the library.
2017-12-13 23:36:22 +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
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
Matthias Möller
5b4855dea2 fix targetname 2017-11-26 10:29:51 +01:00
Niels Lohmann
430f03512c
🚨 fixed some warnings #821 2017-11-25 22:06:18 +01:00
Niels Lohmann
de75cf89f7
improved test coverage 2017-11-25 19:41:02 +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
Théo DELRIEU
4b46abf97c
add forwarding references to json_ref constructor
fixes #805
2017-10-28 14:22:57 +02:00
Niels Lohmann
734e2b73cf
🔨 cleanup 2017-10-27 11:49:24 +02:00
Niels Lohmann
1b1bd0e3e6
#714 is still not fixed 2017-10-23 12:01:50 +02: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
24b6e028a9
improved test coverage 2017-10-22 08:53:27 +02:00
Niels Lohmann
ef40673acb Merge branch 'develop' into develop-simplify-istream 2017-10-22 08:52:15 +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
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
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
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
f585fe4eec Test to confirm parsing of multiple JSON records in a istream #367 2017-10-05 16:01:41 -07:00
Niels Lohmann
615366447a
🔧 removing -Weffc++ warnings 2017-10-05 19:43:19 +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
1b3df3a63f
🔨 trying to use Coveralls with CMake #698 2017-10-04 22:18:21 +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
f89f8b2d0b
Merge branch 'develop' into feature/issue698 2017-10-02 17:47:53 +02:00
Niels Lohmann
8af49d4be5
🚨 removing compiler warnings #755 2017-09-30 11:00:26 +02:00
Niels Lohmann
647711fad1
improved test coverage 2017-09-14 17:31:28 +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
91e0032853
📝 improved documentation 2017-08-29 23:46:26 +02:00
Niels Lohmann
4f5c345817
👷 run sanitizer another time to check if it works 2017-08-26 08:20:37 +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
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
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
9fd031b6f4
🐛 re-added support for std::valarray #702 2017-08-22 23:28:23 +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
72afe53fa0
📝 updated documentation for update() function #661 2017-08-15 21:42:50 +02: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
aad55219f8 Merge branch 'develop' into move-construction 2017-07-30 19:49:24 +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
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
Niels Lohmann
3d589fd032
🔨 fixed compilation error 2017-07-26 23:59:56 +02: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
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
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
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
Ryan Mulder
71597be294 add ensure_ascii parameter to dump. #330 2017-07-11 13:48:08 -04:00
Théo DELRIEU
acff23efb2
move binary_{reader,writer} outside of basic_json 2017-07-09 21:30:33 +02:00