Commit graph

167 commits

Author SHA1 Message Date
abolz
6e2e466c27 Tests: Don't rely on the format used for floating-point formatting 2018-01-15 21:07:25 +01:00
Niels Lohmann
92484f0caf
🔖 set version to 3.0.1 2017-12-29 18:31:13 +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
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
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
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
91e0032853
📝 improved documentation 2017-08-29 23:46:26 +02:00
Niels Lohmann
9fd031b6f4
🐛 re-added support for std::valarray #702 2017-08-22 23:28:23 +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
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
8b123107c0
🔨 fixed some pedantic GCC warnings 2017-07-07 22:41:22 +02:00
Niels Lohmann
6f3bebff5c
🔨 removed unexpect function 2017-06-21 07:26:50 +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
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
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
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
9e507dfad5
tests and fix for #367
operator>> now works as expected.
2017-05-21 16:36:51 +02:00
Niels Lohmann
fba1bcdd0b
🐛 fixing #575
I forgot to consider the offset.
2017-05-07 13:41:48 +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
b15fc13dd1
🔨 implemented MessagePack in binary_reader 2017-04-04 16:59:19 +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
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
06e2a291b1
🔨 fixed number parsing 2017-03-26 17:26:41 +02: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
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
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
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
c5cf32e34d
🔨 added user-defined exception 406 2017-03-12 20:59:33 +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
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
89f6068385
Merge branch 'develop' into feature/exceptions_3.0.0 2017-03-12 11:51:24 +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
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
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
Niels Lohmann
fc9b528ec9
🔨 changed an exception 2017-03-08 18:07:21 +01:00
Niels Lohmann
5407333224
🔨 added user-defined exception 111 2017-03-06 22:37:46 +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
d1b30250d6
added missing tests 2017-02-26 11:50:52 +01:00
Niels Lohmann
27c65b860b
🔖 version 2.1.1 2017-02-25 16:34:38 +01:00
Niels Lohmann
8cec55a271
🚧 fixed more warnings 2017-02-22 18:14:29 +01:00
Niels Lohmann
7d14f167b8
🚑 fix for #465 2017-02-20 22:48:27 +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
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
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
c8191c8172
🔨 further cleanup 2017-02-12 18:50:17 +01:00
Niels Lohmann
8d88a1da2a 🔀 merged #379 and fixed conflicts 2017-02-05 13:13:41 +01:00
Niels Lohmann
d870826811 🔖 set version to 2.1.0 2017-01-28 16:03:35 +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
Théo DELRIEU
3e15b551e0 run make pretty 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
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
cdd3b5a68c 🚑 fix for #416 2017-01-03 23:52:01 +01:00
Niels Lohmann
8b46eb8ec0 📄 it's 2017 already 2017-01-02 09:40:00 +01:00
Niels Lohmann
60b3703c62 🔖 version bump to 2.0.10 2017-01-02 09:35:57 +01:00
Niels Lohmann
cf9bf2d913 🚑 fix for #411 and #412 2017-01-01 15:28:01 +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
303e873ae8 🔖 bumped version to 2.0.9 2016-12-16 20:45:46 +01:00
Niels Lohmann
2f94c30bad added a regression test for #380 / #390 2016-12-13 21:46:07 +01:00
Alex Astashyn
6fba52b6da Merged upstream/develop into feature/locale_independent_str_to_num 2016-12-12 20:27:15 -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
Niels Lohmann
79fa8b2f41 🚑 fix to address #389 2016-12-12 23:19:43 +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
1c029b97c0 Still trying to invoke locale-specific behavior in CI 2016-12-08 22:13:05 -05: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
6774457733 Trying to coerce setlocale to make snprintf use commas as delimiter some more 2016-12-06 22:59:12 -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
2197856395 Fixed suffixing .0 and modified the unit tests accordingly 2016-12-04 01:38:23 -05:00
Alex Astashyn
6b78b5c2be Added strtonum for locale-independent number parsing 2016-12-03 19:05:09 -05:00