Commit graph

921 commits

Author SHA1 Message Date
Niels Lohmann 34430994bf
add tests for binary type 2020-05-09 14:16:57 +02:00
Niels Lohmann 3fa94f0755
add tests for binary type 2020-05-09 13:46:24 +02:00
Niels Lohmann f0c6ab4d3b
🐛 fix bug in SAX callback parser 2020-05-08 14:21:11 +02:00
Niels Lohmann 5bfb27c865
🚨 fix some warnings 2020-05-08 12:32:28 +02:00
Niels Lohmann cf4a6552f3
add tests for binary serialization 2020-05-06 22:24:48 +02:00
Niels Lohmann 3cd2a977ae
add test for get_ptr<binary_t*> 2020-05-06 22:13:55 +02:00
Niels Lohmann 1d6f7b0d4e
add tests for binary serialization 2020-05-06 22:13:31 +02:00
Niels Lohmann ddff459fa3
add test for BSON binary subtype 2020-05-06 21:24:00 +02:00
Niels Lohmann 2b39efd545
add tests for binary type 2020-05-05 12:59:57 +02:00
Niels Lohmann 908941b87d
fix test cases 2020-05-05 07:47:20 +02:00
Niels Lohmann 2a34f4cd63
add tests for binary type 2020-05-04 22:07:50 +02:00
Niels Lohmann a50a14088c
Merge pull request #2081 from nlohmann/external_test_data
Use external test data
2020-05-04 20:58:02 +02:00
Niels Lohmann 24237af983
🎨 fix format 2020-05-03 13:40:23 +02:00
Niels Lohmann f0050c9ba0
Merge pull request #2019 from dota17/contains_v2
fix #1982:json_pointer.contains() exception is incorrectly raised
2020-05-02 11:04:57 +02:00
Niels Lohmann cfb2f34ebb
🔨 fix benchmarks 2020-05-01 20:59:47 +02:00
Niels Lohmann 7ade3a0efb
remove dependency to FetchContent 2020-05-01 15:14:37 +02:00
Niels Lohmann dbf1a1f413
♻️ download test data from external repository 2020-05-01 14:32:37 +02:00
Rimas Misevičius 6f1800889a Fix tests 2020-05-01 00:59:12 +03:00
Rimas Misevičius 4c053e3ec9 Fix tests 2020-05-01 00:48:24 +03:00
Niels Lohmann 2e5727d778
🐛 properly pass serialize_binary to dump function #2067 2020-04-27 15:10:23 +02:00
Niels Lohmann 63afc8e3f8
Merge pull request #2043 from dota17/unit-constructor1
Add missing testcase about NaN in unit-constructor1.cpp
2020-04-21 07:35:44 +02:00
Niels Lohmann a29e3b1318
Merge pull request #2054 from nlohmann/feature/issue1983
Fix bug in diff function
2020-04-20 19:44:35 +02:00
Niels Lohmann c0a39b22a6
🚨 fix compiler warning 2020-04-20 19:42:58 +02:00
Niels Lohmann 3607687a14
Merge pull request #2053 from nlohmann/gcc10warnings
Fix GCC compiler warnings
2020-04-20 08:05:42 +02:00
chenguoping c379d02b3e Add missing testcase about NaN in unit-constructor1.cpp 2020-04-20 10:25:44 +08:00
Niels Lohmann e8356928bd
🚨 fix compiler warnings #2052 2020-04-19 13:25:02 +02:00
Niels Lohmann 4fb0795ec1
🚨 fix compiler warnings #2049 2020-04-19 13:01:36 +02:00
Niels Lohmann f2b43a36b2
Merge pull request #1662 from OmnipotentEntity/develop
Add binary type support to all binary file formats, as well as an internally represented binary type
2020-04-16 11:14:32 +02:00
Michael Reilly 012c9665ac Add binary type support to all binary file formats, as well as an internally represented binary type 2020-04-14 10:22:45 -04:00
Niels Lohmann dd04a32918
🐛 fix bug in diff function #1983 2020-04-13 14:35:36 +02:00
chenguoping f5a487d1b4 fix issue1982: contains() exceptions are incorrectly raised 2020-04-13 19:41:13 +08:00
Niels Lohmann b7be613b6e
Merge pull request #1990 from dota17/json_pointer
catch exceptions for json_pointer : ..../+99
2020-04-13 13:29:33 +02:00
Niels Lohmann 6121fc52cf
🎨 fix indentation 2020-04-10 13:22:58 +02:00
Artöm Bakri Al-Sarmini 8db02bcc55 Fix for gcc 2020-04-08 15:53:14 +03:00
Artöm Bakri Al-Sarmini fec0bdd93b still fixing 2020-04-08 00:42:03 +03:00
Artöm Bakri Al-Sarmini 4ce31695f1 Fixed formatting, trying to fix msvc build error in appveyor 2020-04-08 00:26:43 +03:00
Artöm Bakri Al-Sarmini a74a031bba Fix build error 2020-04-02 15:47:08 +03:00
Artöm Bakri Al-Sarmini e4d8dc02e8 Fixes #1971 (memory leak in basic_json::push_back) 2020-04-02 15:20:25 +03:00
chenguoping e07686f0c7 update array_index() and add testcases 2020-03-25 15:57:20 +08:00
Francois Chabot 7eadd6daef added back forward declaration to address warnings 2020-02-28 18:15:11 -05:00
Francois Chabot 2e2cf02cfd duck-typed object input adapters 2020-02-19 14:59:31 -05:00
Francois Chabot 617b3cf42e templated input adapters 2020-02-19 10:32:49 -05:00
Antoine Cœur 8d92ca865f Some typos 2020-02-02 17:29:37 +08:00
Sonu Lohani 4c1ebb4413
Fix warning: ignoring return value 2019-12-16 14:22:41 +05:30
Niels Lohmann c5eafe74e8
🔖 set version to 3.7.3 2019-11-17 12:09:12 +01:00
Niels Lohmann 56109eacd7
🔖 set version to 3.7.2 2019-11-10 21:23:39 +01:00
Isaac Nickaein 7e2445a0f4 Move deep JSON test to a separate unit-test 2019-11-09 21:42:39 +03:30
Isaac Nickaein 68d0a7b246 Reduce depth in unit-test to avoid choking valgrind 2019-11-09 21:19:12 +03:30
Isaac Nickaein eec1974218 Merge remote-tracking branch 'nlohmann/develop' into iterate-on-destruction 2019-11-09 14:50:48 +03:30
Niels Lohmann 1a9de88117
🚨 fix a linter warning
Coverity detected two "Memory - illegal accesses  (OVERRUN)" issues. Resizing the buffer should silence this warning.
2019-11-07 08:00:21 +01:00
Niels Lohmann aacdc6bbe3
🔖 set version to 3.7.1 2019-11-06 18:37:26 +01:00
Niels Lohmann 1e9f16dff0
🚨 fix linter errors 2019-11-05 20:25:53 +01:00
Niels Lohmann c0ae88bf50
🚨 fix linter errors 2019-11-05 20:23:17 +01:00
Niels Lohmann 7bcaba0ca9
Merge pull request #1821 from AnthonyVH/develop
Fix for #1647
2019-11-05 19:15:54 +01:00
Anthony VH c4923e3d05 Merge remote-tracking branch 'upstream/develop' into develop 2019-11-04 20:50:43 +01:00
Anthony VH ec9647ae63 Moved test for #1647 regression to regressions file. 2019-11-04 20:45:24 +01:00
Camille Bégué 8b686b30eb Add restriction for tuple specialization of to_json
This commit fix the issue #1825

Signed-off-by: Camille Bégué <c.begue@samsung.com>
2019-11-04 09:57:16 +01:00
Niels Lohmann dfe53c36da
🚨 fix UBSAN warnings 2019-11-03 13:48:25 +01:00
Niels Lohmann a1828bbf57
Merge pull request #1806 from cbegue/develop
Fix issue #1805
2019-11-01 19:46:19 +01:00
Camille Bégué 794a3d411a Fix issue #1805
* Add some restriction on pair partial specialization of to_json

Signed-off-by: Camille Bégué <camille.begue.pro@gmail.com>
2019-10-31 18:04:15 +01:00
Anthony Van Herrewege fb9a2643c8 Add test for #1647. 2019-10-30 15:46:31 +01:00
Niels Lohmann 507d5676ad
🚨 fix warning 2019-10-23 20:57:10 +02:00
Florian Pigorsch b93d414a35 Fix some spelling errors - mostly in comments & documentation.
I did not touch the Changelog file and any third party stuff.

additonal -> additional (1)
apppend -> append (2)
constuctor -> constructor (2)
contect -> context (2)
dobulequote -> doublequote (1)
elemnts -> elements (1)
exakt -> exact (2)
exluded -> exclude (1)
explicitely -> explicitly (2)
narcissic -> narcissistic (1)
ocurred -> occurred (1)
occuring -> occurring (2)
preceeds -> preceded (1)
ot -> to (2)
wehther -> whether (2)
2019-10-19 11:59:51 +02:00
Thomas Braun 35b47c2793 iteration_proxy: Fix integer truncation from std::size_t to int
Bug introduced in 0f073e26 (Allow items() to be used with custom string,
2019-09-26).
2019-10-16 20:00:05 +02:00
Niels Lohmann d187488e0d
Merge pull request #1765 from crazyjul/fix/items-with-alt-string
Allow items() to be used with custom string
2019-10-05 22:11:14 +02:00
christian 7476f5ee0c Make json_pointer::back const (resolves #1764) 2019-10-01 00:57:27 +02:00
Julien Hamaide 0f073e26eb Allow items() to be used with custom string 2019-09-26 13:20:57 +02:00
Miguel Sacristan e26a2904fc Fix and add test's for SFINAE problem 2019-09-10 21:36:23 +02:00
Niels Lohmann 06ccd43a2a
Merge pull request #1722 from t-b/fix-int64-min-issue
Fix int64 min issue
2019-09-10 07:58:02 +02:00
Thomas Braun 8067c3ca5b Add serialization unit tests for extreme integer values 2019-09-03 13:55:19 +02:00
Thomas Braun 70aa8a31a2 Add regression test for dumping the minimum value of int64_t 2019-09-03 13:55:19 +02:00
Thomas Braun 9ea3e19121 .travis/cmake: Rework clang sanitizer invocation
- Switch to clang-7
- Adapt PATH so that llvm-symbolizer can be found for useful stacktraces
- Adapt compile flags
  "-O0" ensures much faster compile times
  "-fno-sanitize-recover=all
  -fsanitize-recover=unsigned-integer-overflow" this fails the build on
  all issues except unsigned integer overflows. Not failing in this case
  is required in combination with the sanitizer suppression file as only
  recoverable errors can be suppressed.

The UBSAN suppression file ignores errors from stl_bvector.h (which
holds std::vector<bool>).

Clang reports that error as

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0/bits/stl_bvector.h:158:20 in

      Start 34: test-deserialization_all
28/88 Test #71: test-testsuites_default .............***Failed    0.32 sec
/usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0/bits/stl_bvector.h:158:20: runtime error: unsigned integer overflow: 0 - 1 cannot be represented in type 'unsigned int'
    #0 0x628f72 in std::_Bit_iterator_base::_M_bump_down() /usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0/bits/stl_bvector.h:158:20
    #1 0x628d16 in std::_Bit_iterator::operator--() /usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0/bits/stl_bvector.h:251:7
    #2 0x634aac in std::vector<bool, std::allocator<bool> >::pop_back() /usr/lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0/bits/stl_bvector.h:1010:7
    #3 0x61eff0 in bool nlohmann::detail::parser<nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::adl_serializer> >::sax_parse_internal<nlohmann::detail::json_sax_dom_parser<nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::adl_serializer> > >(nlohmann::detail::json_sax_dom_parser<nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::adl_serializer> >*) /home/firma/devel/json/include/nlohmann/detail/input/parser.hpp:439:28
    #4 0x604864 in nlohmann::detail::parser<nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::adl_serializer> >::parse(bool, nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::adl_serializer>&) /home/firma/devel/json/include/nlohmann/detail/input/parser.hpp:116:13
    #5 0x5f8079 in nlohmann::operator>>(std::istream&, nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::adl_serializer>&) /home/firma/devel/json/include/nlohmann/json.hpp:6356:42
    #6 0x5e1d92 in _DOCTEST_ANON_FUNC_21() /home/firma/devel/json/test/src/unit-testsuites.cpp:343:9
    #7 0x7207fe in doctest::Context::run() /home/firma/devel/json/test/thirdparty/doctest/doctest.h:5938:21
    #8 0x72681a in main /home/firma/devel/json/test/thirdparty/doctest/doctest.h:6016:71
    #9 0x7f75d22362e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0)
    #10 0x4c28b9 in _start (/home/firma/devel/json/build/test/test-testsuites+0x4c28b9)

The pop_back() in parser.hpp

      assert(not states.empty());
  ->  states.pop_back();

triggers the UBSAN report. But the assertion above ensure that we only
call pop_back() on an non-empty vector, therefore this is a STL library
bug and thus must be ignored for us.
2019-09-03 13:22:03 +02:00
Niels Lohmann 48e1fe03b5
🔖 set version to 3.7.0 2019-07-28 20:20:41 +02:00
Niels Lohmann a501365ea2
Merge branch 'feature/hedley' into develop 2019-07-14 20:58:08 +02:00
Niels Lohmann b17440c12f
🚨 fix compiler warnings 2019-07-12 21:05:16 +02:00
Niels Lohmann 104c5c1996
Merge branch 'feature/json_pointer_contains' into develop 2019-07-09 08:08:56 +02:00
Niels Lohmann 7a23aa1c0d
Merge branch 'feature/emplace_back' into develop 2019-07-09 08:06:27 +02:00
Niels Lohmann 947656544d
🚨 fix warnings 2019-07-02 21:06:42 +02:00
Niels Lohmann 9289a23a76
Merge pull request #1643 from kevinlul/develop
Fix json.hpp compilation issue with other typedefs with same name (Issue #1642)
2019-07-01 22:57:04 +02:00
kevinlul e616d095ab Remove boolean regression test for #1642 2019-06-30 11:57:57 -04:00
Niels Lohmann 1be63431f3
make emplace_back return a reference #1609 2019-06-30 12:19:41 +02:00
Niels Lohmann 258fa798f1
add contains function for JSON pointers 2019-06-30 10:03:08 +02:00
kevinlul 855156b5e8 Add regression tests for #1642 2019-06-29 19:26:38 -04:00
Isaac Nickaein eba8244ead Avoid collision of ::max with windows.h macro 2019-06-22 21:15:13 +04:30
Taylor Howard 2f389cdde7 Added explicit converstion to std::string_view. Fixes failing test with GCC 8.3 2019-06-16 14:49:01 +10:00
Macr0Nerd aa4c45ee4d Added to_string (with ugly macro) and tests 2019-04-26 18:10:45 -05:00
Niels Lohmann e65cff2a8f
🔨 small cleanup 2019-04-05 23:31:04 +02:00
Niels Lohmann f05614b240
🏗️ adding anonymous namespace 2019-04-04 08:56:36 +02:00
Niels Lohmann ee8732c359
Merge pull request #1555 from theodelrieu/fix/1511
Fix/1511
2019-04-03 17:24:25 +02:00
Théo DELRIEU d66abda4ee
tests: fix coverage 2019-04-03 12:34:15 +02:00
Théo DELRIEU e6e6805c6c
add built-in array support in get_to 2019-04-01 17:47:45 +02:00
Théo DELRIEU 2806b201a8
make sure values are overwritten in from_json overloads
Caused unexpected behaviors when using get_to with values previously
set.

Fixes !1511
2019-04-01 17:47:42 +02:00
onqtam da5b7833a0 fixing the remaining of the pedantic gcc/clang target warnings 2019-03-31 13:57:44 +03:00
onqtam a0000c3235 finished the last of the warnings 2019-03-27 01:09:47 +02:00
onqtam 5d511a6e96 fixed a bunch of warnings from the Makefile from the root of the repo 2019-03-27 00:58:53 +02:00
onqtam 2b346099df Merge branch 'develop' of https://github.com/nlohmann/json into doctest 2019-03-24 17:21:44 +02:00
Niels Lohmann baaa2a4d0f
🏁 trying to use constructors from std::allocator #1536 2019-03-21 14:09:29 +01:00
Niels Lohmann efa1b9a7bb
🔖 set version to 3.6.1 2019-03-20 20:50:05 +01:00
Niels Lohmann b37392b7ac
🔖 set version to 3.6.0 2019-03-20 00:19:07 +01:00
Viktor Kirilov 365944b0bc
Merge branch 'develop' into doctest 2019-03-18 16:59:36 +02:00
Niels Lohmann b8451c236f
🚨 fixed warnings 2019-03-17 12:01:49 +01:00
Niels Lohmann 0c65ba960e
Merge branch 'develop' of https://github.com/nlohmann/json into develop 2019-03-13 22:14:57 +01:00
Niels Lohmann 546e2cbf5e
🚨 fixed some warnings 2019-03-13 22:14:53 +01:00
Niels Lohmann c6fc902184
Merge pull request #1489 from andreas-schwab/develop
Do proper endian conversions
2019-03-13 11:57:58 +01:00
Niels Lohmann c983b67112
Merge pull request #1469 from garethsb-sony/json_pointer-append
Add operator/= and operator/ to construct a JSON pointer by appending two JSON pointers
2019-03-11 22:47:08 +01:00
Niels Lohmann 3cd1dac653
🚨 fix MSVC warning #1502 2019-03-11 15:33:23 +01:00
Andreas Schwab bb22b1003f Do proper endian conversions
This fixes all testsuite failures on big endian hosts.
2019-02-25 12:09:13 +01:00
garethsb-sony d183bd0456 Tests for json_pointer::empty and json_pointer::parent_pointer 2019-02-25 09:26:08 +00:00
Laurent Stacul ddc9f201f4 Fix gcc9 build error test/src/unit-allocator.cpp (Issue #1472) 2019-02-22 16:05:41 +00:00
Isaac Nickaein e93f305494 Add unit-test for contains() member function 2019-02-13 13:21:54 +03:30
garethsb-sony 5da757bbb3 Attempt to satisfy Coveralls by adding a test for (unchanged) operator std::string 2019-01-31 23:39:57 +00:00
garethsb-sony c850e9d82d Add operator/= and operator/ to construct a JSON pointer by appending two JSON pointers, as well as convenience op/= and op= to append a single unescaped token or array index; inspired by std::filesystem::path 2019-01-31 19:15:50 +00:00
Isaac Nickaein 372c4d2125
Merge branch 'develop' into iterate-on-destruction 2019-01-28 02:41:22 +03:30
Patrick Boettcher a06e7f5d80 JSON-pointer: add operator+() returning a new json_pointer 2019-01-24 16:46:51 +01:00
Niels Lohmann e89c946451
Merge branch 'feature/nodiscard' into develop 2019-01-20 15:41:30 +01:00
Niels Lohmann 6de4df23e4
🐛 fixed integer overflow in dump function #1447
Closes #1447.
2019-01-20 12:26:01 +01:00
Niels Lohmann e17e0d031f
Merge pull request #1446 from scinart/develop
attempt to fix #1445, flush buffer in serializer::dump_escaped in UTF8_REJECT case.
2019-01-20 12:18:02 +01:00
scinart 20db020c1f move newly-added tests in unit-regression.cpp 2019-01-19 11:36:50 -05:00
Niels Lohmann d359fd3a8d
🚧 trying nodiscard attribute #1433 2019-01-19 17:32:23 +01:00
scinart 899bd94b43 flush buffer in serializer::dump_escaped case UTF8_REJECT
serializer use fixed buffer. Whenever it is nearly full, it is flushed to `output_adapter_t<char> o`
But the code forgets to flush when there is a invalid utf8 code point
So there will be buffer overflow.
2019-01-18 20:35:48 -05:00
onqtam 2f44ac1def moved from Catch to doctest for unit tests 2019-01-15 22:02:16 +02:00
Isaac Nickaein 47fe4b9cee Add unit test for parsing deeply-nested array 2019-01-15 20:22:11 +03:30
Patrick Boettcher 9225cf2f57 allow push_back() and pop_back() calls on json_pointer
Putting pop_back() to public and creating a trivial push_back()
method allows users of nlohmann::json_pointer to manipulate an
existing json-pointer by adding or removing keys at the end.

This is useful for traversing a JSON-instance and keeping track
of its "absolute path" at any moment.

In my case for a schema-validator error-handler.
2019-01-15 14:43:46 +01:00
Isaac Nickaein c9dd260a4c Add unit tests for dump_integer
Add some unit tests for formatting integers
to keep code coverage as before.
2019-01-12 08:58:30 -08:00
Isaac Nickaein be9b4cbd60 Add benchmark for small integers
This benchmark is a sample of 1 million "small" integers
in range [-1000000 1000000) sampled from uniform distribution.
2019-01-12 08:58:30 -08:00
Niels Lohmann 6f89613acd
🚨 fixed some warnings 2018-12-23 13:56:18 +01:00
Niels Lohmann 78348afeb6
🔖 set version to 3.5.0 2018-12-21 23:52:29 +01:00
Niels Lohmann d584ab269a
🎨 fixed header 2018-12-20 21:58:16 +01:00
Niels Lohmann 45a8a093d7
🚨 fixed a warning 2018-12-20 21:40:47 +01:00
Niels Lohmann 85849940ba
Merge pull request #1391 from pratikpc/develop
Added Support for Structured Bindings
2018-12-20 08:58:08 +01:00
Pratik Chowdhury ebd3f45808 Added Support for Structured Bindings
For further details, read https://github.com/nlohmann/json/issues/1388 and https://blog.tartanllama.xyz/structured-bindings/
2018-12-19 20:17:52 +05:30
Niels Lohmann 5d390e91ff
Merge pull request #1392 from mtalliance/feature/addFileInputAdapter
Feature/add file input adapter
2018-12-16 22:10:03 +01:00
Jonathan Dumaresq 635a4fc344 use namespace std when possible. Change the name of private variable. 2018-12-12 16:33:25 -05:00
Jonathan Dumaresq a794cfdba3 refactor unit test in case of throw, the fclose will not be called. using unique_ptr with custom destructor will ensure that 2018-12-12 14:46:17 -05:00
Jonathan Dumaresq ef283e0cf8 add tests to cover the new input adapter 2018-12-12 10:18:37 -05:00
mefyl aa10382629 Set eofbit on exhausted input stream.
Fix issue #1340.

        The eofbit is set manually since we don't go through the
	stream interface. We could maybe use the stream interface
	instead, but there are some assumptions regarding which
	exception go through, so this seems to be the most prudent
	approach for now.
2018-11-08 11:41:17 +01:00
Niels Lohmann 2f73a4d1f3
🚨 fixed a linter warning 2018-10-31 20:30:24 +01:00
Niels Lohmann 7b2f8cce03
🔖 set version to 3.4.0 2018-10-30 21:30:20 +01:00
Niels Lohmann 39419cd5c4
🚨 fixed another linter warning 2018-10-29 18:51:30 +01:00
Niels Lohmann f0c1459554
🐛 fixed a bug parsing BSON strings #1320 2018-10-28 09:16:40 +01:00
Niels Lohmann 45a761bd60
Merge branch 'develop' of https://github.com/nlohmann/json into develop 2018-10-27 18:31:06 +02:00
Niels Lohmann 4e765596f7
🔨 small improvements 2018-10-27 18:31:03 +02:00
Niels Lohmann 85aaf91b85
Merge branch 'develop' into feature/enum_json_mapping 2018-10-27 16:52:59 +02:00
Niels Lohmann ad639ad5e6
added NLOHMANN_JSON_SERIALIZE_ENUM marco #1208 2018-10-26 14:48:20 +02:00
Niels Lohmann d97fa30795
👌 fixed comment #1320 2018-10-25 22:29:27 +02:00
Niels Lohmann 19647e083c
🚨 fixed compiler warnings 2018-10-25 14:27:55 +02:00
Niels Lohmann 62126278a6
🔨 added fix for arrays 2018-10-25 13:01:18 +02:00
Niels Lohmann 1968e5c793
🎨 clean up binary formats 2018-10-24 23:39:30 +02:00
Niels Lohmann 4d1eaace8c
🔨 fixed fuzz code to avoid false positives in case of discarded values 2018-10-24 18:55:08 +02:00
Niels Lohmann e2c5913a50
🚧 some changes to the BSON code
- added fuzz testers
- added some reference files
- made an exception text more clear
2018-10-24 15:43:37 +02:00
Niels Lohmann bba159121f
Merge branch 'feature/bson' of https://github.com/julian-becker/json into julian-becker-feature/bson 2018-10-24 15:03:15 +02:00
Niels Lohmann 7b501de054
Merge pull request #1314 from nlohmann/feature/codec_errors
Allow to set error handler for decoding errors
2018-10-24 08:40:58 +02:00
Niels Lohmann 2343d9caeb
💚 additional tests from the Unicode spec #1198
Thanks @abolz!
2018-10-23 17:22:13 +02:00
Niels Lohmann 951a7a6455
🚧 fixed test cases #1198 2018-10-22 18:20:45 +02:00
Niels Lohmann c51b1e6fab
🚧 fixed an issue with ensure_ascii #1198 2018-10-22 15:53:36 +02:00
Niels Lohmann c7af027cbb
🚧 respect ensure_ascii parameter #1198 2018-10-22 09:18:16 +02:00
Niels Lohmann e5dce64115
💚 added tests #1198
Test every prefix of Unicode sequences against the different dump functions.
2018-10-21 23:26:25 +02:00
Niels Lohmann c5821d91e5
🚧 overworked error handlers #1198 2018-10-21 11:49:37 +02:00
Julian Becker ad11b6c35e BSON: Improved exception-related tests and report location of U+0000 in the key-string as part of out_of_range.409-message 2018-10-18 20:05:46 +02:00
Niels Lohmann 9294e25c98
Merge pull request #1301 from theodelrieu/fix/1299
add new is_constructible_* traits used in from_json
2018-10-18 19:18:48 +02:00
Julian Becker 5ba812d518 BSON: fixed incorrect casting in unit-bson.cpp 2018-10-18 06:38:34 +02:00
Julian Becker 2a63869159 Merge branch 'develop' of https://github.com/nlohmann/json into feature/bson
Conflicts:
	include/nlohmann/detail/input/binary_reader.hpp
	single_include/nlohmann/json.hpp
	src/unit-bson.cpp
2018-10-17 20:26:00 +02:00
Niels Lohmann dbb0b63187
improved error messages for binary formats #1288
This commit is the equivalent of #1282 for CBOR, MessagePack, and UBJSON.
2018-10-17 12:15:58 +02:00
Julian Becker 978c3c4116 BSON: throw json.exception.out_of_range.409 in case a key to be serialized to BSON contains a U+0000 2018-10-16 20:42:00 +02:00
Julian Becker 5bccacda30 BSON: throw json.exception.out_of_range.407 in case a value of type std::uint64_t is serialized to BSON. Also, added a missing EOF-check to binary_reader. 2018-10-16 19:13:07 +02:00
Théo DELRIEU 45c8af2c46
add new is_constructible_* traits used in from_json
is_compatible_* traits were used in from_json, but it made no sense
whatsoever.

It used to work because of non-SFINAE correctness + json_ref
unconstrained variadic template constructor.

SFINAE checks are becoming quite complex, we need a specification of
some sort describing:

* which concepts the library uses
* how the conversion to/from json works in detail

Having such a specification would really help simplifying the current
code (as well as having meaningful checks).

Fixes !1299
2018-10-16 14:00:34 +02:00
Théo DELRIEU 11fecc25af
add constraints for variadic json_ref constructors
Fixes #1292
2018-10-12 10:54:58 +02:00
Niels Lohmann 74a31075e3
improved parse error messages 2018-10-07 22:39:17 +02:00
Julian Becker df0f612d1b BSON: allow and discard values and object entries of type value_t::discarded 2018-10-07 20:08:05 +02:00
Julian Becker 062aeaf7b6 BSON: Reworked the binary_writer such that it precomputes the size of the BSON-output.
This way, the output_adapter can work on simple output iterators and no longer requires random access iterators.
2018-10-07 18:02:51 +02:00
Niels Lohmann 6d09cdec34
🐛 fixed a bug in the unget function 2018-10-07 16:48:45 +02:00
Niels Lohmann 011b15dd08
added line positions to error messages
This is a follow-up to #1210.
2018-10-07 12:27:24 +02:00
Julian Becker 81f4b34e06 BSON: Improved documentation and error handling/reporting 2018-10-07 09:57:55 +02:00
Niels Lohmann b968faa882
🔖 set version to 3.3.0 2018-10-05 10:59:33 +02:00
Niels Lohmann 1fae82b7a7
Merge branch 'develop' into fix/1237 2018-09-29 14:50:36 +02:00
Niels Lohmann d26f39466e
Merge pull request #1231 from theodelrieu/feature/get_with_parameter
Add a get overload taking a parameter.
2018-09-29 14:30:04 +02:00
knilch 8c1387cfb3
unit-testsuites.cpp: fix hangup if file not found
If run from the wrong directory, std::ifstream f("test/data/big-list-of-naughty-strings/blns.json"); will not find the file and thus f.eof() will never return true.
Use canonical C++ file reading loop from https://gehrcke.de/2011/06/reading-files-in-c-using-ifstream-dealing-correctly-with-badbit-failbit-eofbit-and-perror/ instead.
2018-09-28 11:33:23 +02:00
Théo DELRIEU 521fe49fec
Add basic_json::get_to function.
Takes an lvalue reference, and returns the same reference.

This allows non-default constructible types to be converted without
specializing adl_serializer.
This overload does not require CopyConstructible either.

Implements #1227
2018-09-28 11:25:23 +02:00
Henry Fredrick Schreiner 7a37ba0c02 Adding 4.8 test to travis 2018-09-27 22:31:39 +02:00
Julian Becker ef358ae695 BSON: Fixed hangup in case of incomplete bson input and improved test coverage 2018-09-25 20:34:25 +02:00
Julian Becker bce4816275 BSON: Added test case for the different input/output_adapters 2018-09-24 23:35:19 +02:00
Julian Becker 763705c2a7 Fix: Add missing begin() and end() member functions to alt_string 2018-09-24 19:50:28 +02:00
Théo DELRIEU 4e52277b70
Fix issue #1237
* Make the conversion operator SFINAE correct.
* Workaround a GCC bug with some traits in type_traits.hpp

The first bullet-point implies that every `get`/`get_ptr` be SFINAE
correct as well.
2018-09-20 10:33:14 +02:00
Ben Berman 8f07ab6392 Replace "key-style argument" with "string argument" 2018-09-17 15:36:38 -04:00
Julian Becker df33a90774 BSON: Bugfix for non-empty arrays 2018-09-15 14:08:38 +02:00
Julian Becker cf485c2907 BSON: Support for arrays 2018-09-15 13:54:08 +02:00
Julian Becker 120d1d77d4 BSON: test case for a more complex document 2018-09-15 13:41:05 +02:00
Julian Becker 5ce7d6bdd7 BSON: support objects with objects as members 2018-09-15 13:03:42 +02:00
Julian Becker 83b427ad67 BSON: unsigned integers 2018-09-15 12:20:30 +02:00
Julian Becker c0d8921a67 BSON: support objects with int64 members 2018-09-15 12:00:53 +02:00
Julian Becker 7ee361f7ad BSON: support objects with int32 members 2018-09-15 11:54:17 +02:00
Julian Becker c5ef023171 BSON: support objects with null members 2018-09-15 11:39:12 +02:00
Julian Becker 6c447de076 BSON: Support objects with string members 2018-09-15 11:33:24 +02:00
Julian Becker 0c0f2e44b5 BSON: support doubles 2018-09-15 10:32:03 +02:00
Julian Becker 9a0dddc5d2 BSON: Object with single boolean 2018-09-15 03:08:50 +02:00
Julian Becker 5f5836ce1c BSON: Support empty objects 2018-09-15 00:43:39 +02:00
Julian Becker f06c8fd8e3 BSON: serialization of non-objects is not supported 2018-09-15 00:20:03 +02:00
Niels Lohmann ebb3c03293
🎨 cleanup after #1228 2018-09-09 18:19:33 +02:00
Théo DELRIEU 4b4bbceebf
make from_json SFINAE-correct 2018-09-07 14:10:37 +02:00
Ben Berman ad053ef09c Fix tests for improved error 305(hopefully) 2018-08-30 13:21:55 -04:00