Lines Matching refs:json
4 // |_____|_____|_____|_|___| https://github.com/nlohmann/json
12 #include <nlohmann/json.hpp>
13 using nlohmann::json;
37 bool number_integer(json::number_integer_t val)
43 bool number_unsigned(json::number_unsigned_t val)
49 bool number_float(json::number_float_t /*unused*/, const std::string& s)
61 bool binary(json::binary_t& val)
120 bool parse_error(std::size_t position, const std::string& /*unused*/, const json::exception& /*unused*/)
131 class SaxCountdown : public nlohmann::json::json_sax_t
147 bool number_integer(json::number_integer_t /*val*/) override
152 bool number_unsigned(json::number_unsigned_t /*val*/) override
157 bool number_float(json::number_float_t /*val*/, const std::string& /*s*/) override
167 bool binary(json::binary_t& /*val*/) override
197 bool parse_error(std::size_t /*position*/, const std::string& /*last_token*/, const json::exception& /*ex*/) override
206 json parser_helper(const std::string& s);
210 json parser_helper(const std::string& s)
212 json j;
213 json::parser(nlohmann::detail::input_adapter(s)).parse(true, j);
217 json j_nothrow;
218 CHECK_NOTHROW(json::parser(nlohmann::detail::input_adapter(s), nullptr, false).parse(true, j_nothrow));
221 json j_sax;
222 nlohmann::detail::json_sax_dom_parser<json> sdp(j_sax);
223 json::sax_parse(s, &sdp);
236 json j;
237 CHECK_NOTHROW(json::parser(nlohmann::detail::input_adapter(s), nullptr, false).parse(true, j));
241 const bool ok_accept = json::parser(nlohmann::detail::input_adapter(s)).accept(true);
248 CHECK_NOTHROW(json::sax_parse(s, &el, json::input_format_t::json, false));
249 CHECK(json::parser(nlohmann::detail::input_adapter(s)).accept(false) == !el.errored);
252 json::parser_callback_t cb = [](int /*unused*/, json::parse_event_t /*unused*/, json& /*unused*/) noexcept
256 json j_cb = json::parse(s, cb, false);
274 json _;
277 CHECK_NOTHROW(_ = json::parse(s));
278 CHECK(json::accept(s));
281 CHECK_NOTHROW(_ = json::parse(s, nullptr, false, true));
282 CHECK(json::accept(s, true));
297 CHECK_THROWS_AS(_ = json::parse(json_with_comment), json::parse_error);
298 CHECK(!json::accept(json_with_comment));
300 CHECK_NOTHROW(_ = json::parse(json_with_comment, nullptr, true, true));
301 CHECK(json::accept(json_with_comment, true));
313 CHECK(parser_helper("null") == json(nullptr));
318 CHECK(parser_helper("true") == json(true));
323 CHECK(parser_helper("false") == json(false));
330 CHECK(parser_helper("[]") == json(json::value_t::array));
331 CHECK(parser_helper("[ ]") == json(json::value_t::array));
336 CHECK(parser_helper("[true, false, null]") == json({true, false, nullptr}));
344 CHECK(parser_helper("{}") == json(json::value_t::object));
345 CHECK(parser_helper("{ }") == json(json::value_t::object));
350 CHECK(parser_helper("{\"\": true, \"one\": 1, \"two\": null}") == json({{"", true}, {"one", 1}, {"two", nullptr}}));
357 CHECK(parser_helper("\"\"") == json(json::value_t::string));
362 CHECK_THROWS_WITH_AS(parser_helper("\"\t\""), "[json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing value - invalid string: control character U+0009 (HT) must be escaped to \\u0009 or \\t; last read: '\"<U+0009>'", json::parse_error&);
364 CHECK_THROWS_WITH_AS(parser_helper("\"\n\""), "[json.exception.parse_error.101] parse error at line 2, column 0: syntax error while parsing value - invalid string: control character U+000A (LF) must be escaped to \\u000A or \\n; last read: '\"<U+000A>'", json::parse_error&);
365 CHECK_THROWS_WITH_AS(parser_helper("\"\r\""), "[json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing value - invalid string: control character U+000D (CR) must be escaped to \\u000D or \\r; last read: '\"<U+000D>'", json::parse_error&);
367 CHECK_THROWS_WITH_AS(parser_helper("\"\b\""), "[json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing value - invalid string: control character U+0008 (BS) must be escaped to \\u0008 or \\b; last read: '\"<U+0008>'", json::parse_error&);
369 CHECK_THROWS_AS(parser_helper("\uFF01"), json::parse_error&);
370 CHECK_THROWS_AS(parser_helper("[-4:1,]"), json::parse_error&);
372 CHECK_THROWS_WITH_AS(parser_helper("\"\x00\""), "[json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing value - invalid string: missing closing quote; last read: '\"'", json::parse_error&); // NOLINT(bugprone-string-literal-with-embedded-nul)
373 CHECK_THROWS_WITH_AS(parser_helper("\"\x01\""), "[json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing value - invalid string: control character U+0001 (SOH) must be escaped to \\u0001; last read: '\"<U+0001>'", json::parse_error&);
374 CHECK_THROWS_WITH_AS(parser_helper("\"\x02\""), "[json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing value - invalid string: control character U+0002 (STX) must be escaped to \\u0002; last read: '\"<U+0002>'", json::parse_error&);
375 CHECK_THROWS_WITH_AS(parser_helper("\"\x03\""), "[json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing value - invalid string: control character U+0003 (ETX) must be escaped to \\u0003; last read: '\"<U+0003>'", json::parse_error&);
376 CHECK_THROWS_WITH_AS(parser_helper("\"\x04\""), "[json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing value - invalid string: control character U+0004 (EOT) must be escaped to \\u0004; last read: '\"<U+0004>'", json::parse_error&);
377 CHECK_THROWS_WITH_AS(parser_helper("\"\x05\""), "[json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing value - invalid string: control character U+0005 (ENQ) must be escaped to \\u0005; last read: '\"<U+0005>'", json::parse_error&);
378 CHECK_THROWS_WITH_AS(parser_helper("\"\x06\""), "[json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing value - invalid string: control character U+0006 (ACK) must be escaped to \\u0006; last read: '\"<U+0006>'", json::parse_error&);
379 CHECK_THROWS_WITH_AS(parser_helper("\"\x07\""), "[json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing value - invalid string: control character U+0007 (BEL) must be escaped to \\u0007; last read: '\"<U+0007>'", json::parse_error&);
380 CHECK_THROWS_WITH_AS(parser_helper("\"\x08\""), "[json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing value - invalid string: control character U+0008 (BS) must be escaped to \\u0008 or \\b; last read: '\"<U+0008>'", json::parse_error&);
381 CHECK_THROWS_WITH_AS(parser_helper("\"\x09\""), "[json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing value - invalid string: control character U+0009 (HT) must be escaped to \\u0009 or \\t; last read: '\"<U+0009>'", json::parse_error&);
382 CHECK_THROWS_WITH_AS(parser_helper("\"\x0a\""), "[json.exception.parse_error.101] parse error at line 2, column 0: syntax error while parsing value - invalid string: control character U+000A (LF) must be escaped to \\u000A or \\n; last read: '\"<U+000A>'", json::parse_error&);
383 CHECK_THROWS_WITH_AS(parser_helper("\"\x0b\""), "[json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing value - invalid string: control character U+000B (VT) must be escaped to \\u000B; last read: '\"<U+000B>'", json::parse_error&);
384 CHECK_THROWS_WITH_AS(parser_helper("\"\x0c\""), "[json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing value - invalid string: control character U+000C (FF) must be escaped to \\u000C or \\f; last read: '\"<U+000C>'", json::parse_error&);
385 CHECK_THROWS_WITH_AS(parser_helper("\"\x0d\""), "[json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing value - invalid string: control character U+000D (CR) must be escaped to \\u000D or \\r; last read: '\"<U+000D>'", json::parse_error&);
386 CHECK_THROWS_WITH_AS(parser_helper("\"\x0e\""), "[json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing value - invalid string: control character U+000E (SO) must be escaped to \\u000E; last read: '\"<U+000E>'", json::parse_error&);
387 CHECK_THROWS_WITH_AS(parser_helper("\"\x0f\""), "[json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing value - invalid string: control character U+000F (SI) must be escaped to \\u000F; last read: '\"<U+000F>'", json::parse_error&);
388 CHECK_THROWS_WITH_AS(parser_helper("\"\x10\""), "[json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing value - invalid string: control character U+0010 (DLE) must be escaped to \\u0010; last read: '\"<U+0010>'", json::parse_error&);
389 CHECK_THROWS_WITH_AS(parser_helper("\"\x11\""), "[json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing value - invalid string: control character U+0011 (DC1) must be escaped to \\u0011; last read: '\"<U+0011>'", json::parse_error&);
390 CHECK_THROWS_WITH_AS(parser_helper("\"\x12\""), "[json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing value - invalid string: control character U+0012 (DC2) must be escaped to \\u0012; last read: '\"<U+0012>'", json::parse_error&);
391 CHECK_THROWS_WITH_AS(parser_helper("\"\x13\""), "[json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing value - invalid string: control character U+0013 (DC3) must be escaped to \\u0013; last read: '\"<U+0013>'", json::parse_error&);
392 CHECK_THROWS_WITH_AS(parser_helper("\"\x14\""), "[json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing value - invalid string: control character U+0014 (DC4) must be escaped to \\u0014; last read: '\"<U+0014>'", json::parse_error&);
393 CHECK_THROWS_WITH_AS(parser_helper("\"\x15\""), "[json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing value - invalid string: control character U+0015 (NAK) must be escaped to \\u0015; last read: '\"<U+0015>'", json::parse_error&);
394 CHECK_THROWS_WITH_AS(parser_helper("\"\x16\""), "[json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing value - invalid string: control character U+0016 (SYN) must be escaped to \\u0016; last read: '\"<U+0016>'", json::parse_error&);
395 CHECK_THROWS_WITH_AS(parser_helper("\"\x17\""), "[json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing value - invalid string: control character U+0017 (ETB) must be escaped to \\u0017; last read: '\"<U+0017>'", json::parse_error&);
396 CHECK_THROWS_WITH_AS(parser_helper("\"\x18\""), "[json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing value - invalid string: control character U+0018 (CAN) must be escaped to \\u0018; last read: '\"<U+0018>'", json::parse_error&);
397 CHECK_THROWS_WITH_AS(parser_helper("\"\x19\""), "[json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing value - invalid string: control character U+0019 (EM) must be escaped to \\u0019; last read: '\"<U+0019>'", json::parse_error&);
398 CHECK_THROWS_WITH_AS(parser_helper("\"\x1a\""), "[json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing value - invalid string: control character U+001A (SUB) must be escaped to \\u001A; last read: '\"<U+001A>'", json::parse_error&);
399 CHECK_THROWS_WITH_AS(parser_helper("\"\x1b\""), "[json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing value - invalid string: control character U+001B (ESC) must be escaped to \\u001B; last read: '\"<U+001B>'", json::parse_error&);
400 CHECK_THROWS_WITH_AS(parser_helper("\"\x1c\""), "[json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing value - invalid string: control character U+001C (FS) must be escaped to \\u001C; last read: '\"<U+001C>'", json::parse_error&);
401 CHECK_THROWS_WITH_AS(parser_helper("\"\x1d\""), "[json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing value - invalid string: control character U+001D (GS) must be escaped to \\u001D; last read: '\"<U+001D>'", json::parse_error&);
402 CHECK_THROWS_WITH_AS(parser_helper("\"\x1e\""), "[json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing value - invalid string: control character U+001E (RS) must be escaped to \\u001E; last read: '\"<U+001E>'", json::parse_error&);
403 CHECK_THROWS_WITH_AS(parser_helper("\"\x1f\""), "[json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing value - invalid string: control character U+001F (US) must be escaped to \\u001F; last read: '\"<U+001F>'", json::parse_error&);
413 json _;
414 CHECK_THROWS_WITH_AS(_ = json::parse(s.begin(), s.end()), "[json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing value - invalid string: control character U+0000 (NUL) must be escaped to \\u0000; last read: '\"<U+0000>'", json::parse_error&);
429 CHECK(parser_helper("\"\\b\"") == json("\b"));
431 CHECK(parser_helper("\"\\f\"") == json("\f"));
433 CHECK(parser_helper("\"\\n\"") == json("\n"));
435 CHECK(parser_helper("\"\\r\"") == json("\r"));
437 CHECK(parser_helper("\"\\t\"") == json("\t"));
439 CHECK(parser_helper("\"\\u0001\"").get<json::string_t>() == "\x01");
440 CHECK(parser_helper("\"\\u000a\"").get<json::string_t>() == "\n");
441 CHECK(parser_helper("\"\\u00b0\"").get<json::string_t>() == "°");
442 CHECK(parser_helper("\"\\u0c00\"").get<json::string_t>() == "ఀ");
443 CHECK(parser_helper("\"\\ud000\"").get<json::string_t>() == "퀀");
444 CHECK(parser_helper("\"\\u000E\"").get<json::string_t>() == "\x0E");
445 CHECK(parser_helper("\"\\u00F0\"").get<json::string_t>() == "ð");
446 CHECK(parser_helper("\"\\u0100\"").get<json::string_t>() == "Ā");
447 CHECK(parser_helper("\"\\u2000\"").get<json::string_t>() == " ");
448 CHECK(parser_helper("\"\\uFFFF\"").get<json::string_t>() == "");
449 CHECK(parser_helper("\"\\u20AC\"").get<json::string_t>() == "€");
450 CHECK(parser_helper("\"€\"").get<json::string_t>() == "€");
451 CHECK(parser_helper("\"?\"").get<json::string_t>() == "?");
453 CHECK(parser_helper("\"\\ud80c\\udc60\"").get<json::string_t>() == "\xf0\x93\x81\xa0");
454 CHECK(parser_helper("\"\\ud83c\\udf1e\"").get<json::string_t>() == "?");
464 CHECK(parser_helper("-128") == json(-128));
465 CHECK(parser_helper("-0") == json(-0));
466 CHECK(parser_helper("0") == json(0));
467 CHECK(parser_helper("128") == json(128));
472 CHECK(parser_helper("0e1") == json(0e1));
473 CHECK(parser_helper("0E1") == json(0e1));
475 CHECK(parser_helper("10000E-4") == json(10000e-4));
476 CHECK(parser_helper("10000E-3") == json(10000e-3));
477 CHECK(parser_helper("10000E-2") == json(10000e-2));
478 CHECK(parser_helper("10000E-1") == json(10000e-1));
479 CHECK(parser_helper("10000E0") == json(10000e0));
480 CHECK(parser_helper("10000E1") == json(10000e1));
481 CHECK(parser_helper("10000E2") == json(10000e2));
482 CHECK(parser_helper("10000E3") == json(10000e3));
483 CHECK(parser_helper("10000E4") == json(10000e4));
485 CHECK(parser_helper("10000e-4") == json(10000e-4));
486 CHECK(parser_helper("10000e-3") == json(10000e-3));
487 CHECK(parser_helper("10000e-2") == json(10000e-2));
488 CHECK(parser_helper("10000e-1") == json(10000e-1));
489 CHECK(parser_helper("10000e0") == json(10000e0));
490 CHECK(parser_helper("10000e1") == json(10000e1));
491 CHECK(parser_helper("10000e2") == json(10000e2));
492 CHECK(parser_helper("10000e3") == json(10000e3));
493 CHECK(parser_helper("10000e4") == json(10000e4));
495 CHECK(parser_helper("-0e1") == json(-0e1));
496 CHECK(parser_helper("-0E1") == json(-0e1));
497 CHECK(parser_helper("-0E123") == json(-0e123));
500 CHECK(parser_helper("10E0") == json(10e0));
501 CHECK(parser_helper("10E1") == json(10e1));
502 CHECK(parser_helper("10E2") == json(10e2));
503 CHECK(parser_helper("10E3") == json(10e3));
504 CHECK(parser_helper("10E4") == json(10e4));
505 CHECK(parser_helper("10E5") == json(10e5));
506 CHECK(parser_helper("10E6") == json(10e6));
507 CHECK(parser_helper("10E7") == json(10e7));
508 CHECK(parser_helper("10E8") == json(10e8));
509 CHECK(parser_helper("10E9") == json(10e9));
510 CHECK(parser_helper("10E+0") == json(10e0));
511 CHECK(parser_helper("10E+1") == json(10e1));
512 CHECK(parser_helper("10E+2") == json(10e2));
513 CHECK(parser_helper("10E+3") == json(10e3));
514 CHECK(parser_helper("10E+4") == json(10e4));
515 CHECK(parser_helper("10E+5") == json(10e5));
516 CHECK(parser_helper("10E+6") == json(10e6));
517 CHECK(parser_helper("10E+7") == json(10e7));
518 CHECK(parser_helper("10E+8") == json(10e8));
519 CHECK(parser_helper("10E+9") == json(10e9));
520 CHECK(parser_helper("10E-1") == json(10e-1));
521 CHECK(parser_helper("10E-2") == json(10e-2));
522 CHECK(parser_helper("10E-3") == json(10e-3));
523 CHECK(parser_helper("10E-4") == json(10e-4));
524 CHECK(parser_helper("10E-5") == json(10e-5));
525 CHECK(parser_helper("10E-6") == json(10e-6));
526 CHECK(parser_helper("10E-7") == json(10e-7));
527 CHECK(parser_helper("10E-8") == json(10e-8));
528 CHECK(parser_helper("10E-9") == json(10e-9));
567 CHECK(parser_helper("-128.5") == json(-128.5));
568 CHECK(parser_helper("0.999") == json(0.999));
569 CHECK(parser_helper("128.5") == json(128.5));
570 CHECK(parser_helper("-0.0") == json(-0.0));
575 CHECK(parser_helper("-128.5E3") == json(-128.5E3));
576 CHECK(parser_helper("-128.5E-3") == json(-128.5E-3));
577 CHECK(parser_helper("-0.0e1") == json(-0.0e1));
578 CHECK(parser_helper("-0.0E1") == json(-0.0e1));
585 CHECK_THROWS_WITH_AS(parser_helper("1.18973e+4932").empty(), "[json.exception.out_of_range.406] number overflow parsing '1.18973e+4932'", json::out_of_range&);
591 CHECK_THROWS_AS(parser_helper("+1"), json::parse_error&);
592 CHECK_THROWS_AS(parser_helper("+0"), json::parse_error&);
595 "[json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing value - unexpected number literal; expected end of input", json::parse_error&);
597 "[json.exception.parse_error.101] parse error at line 1, column 3: syntax error while parsing value - unexpected number literal; expected end of input", json::parse_error&);
599 "[json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing value - invalid number; expected digit after '-'; last read: '--'", json::parse_error&);
601 "[json.exception.parse_error.101] parse error at line 1, column 3: syntax error while parsing value - invalid number; expected digit after '.'; last read: '1.'", json::parse_error&);
603 "[json.exception.parse_error.101] parse error at line 1, column 3: syntax error while parsing value - invalid number; expected '+', '-', or digit after exponent; last read: '1E'", json::parse_error&);
605 "[json.exception.parse_error.101] parse error at line 1, column 4: syntax error while parsing value - invalid number; expected digit after exponent sign; last read: '1E-'", json::parse_error&);
607 "[json.exception.parse_error.101] parse error at line 1, column 3: syntax error while parsing value - invalid number; expected digit after '.'; last read: '1.E'", json::parse_error&);
609 "[json.exception.parse_error.101] parse error at line 1, column 4: syntax error while parsing value - invalid number; expected '+', '-', or digit after exponent; last read: '-1E'", json::parse_error&);
611 "[json.exception.parse_error.101] parse error at line 1, column 4: syntax error while parsing value - invalid number; expected '+', '-', or digit after exponent; last read: '-0E#'", json::parse_error&);
613 "[json.exception.parse_error.101] parse error at line 1, column 5: syntax error while parsing value - invalid number; expected digit after exponent sign; last read: '-0E-#'", json::parse_error&);
615 "[json.exception.parse_error.101] parse error at line 1, column 3: syntax error while parsing value - invalid literal; last read: '-0#'; expected end of input", json::parse_error&);
617 "[json.exception.parse_error.101] parse error at line 1, column 5: syntax error while parsing value - unexpected ':'; expected end of input", json::parse_error&);
619 "[json.exception.parse_error.101] parse error at line 1, column 5: syntax error while parsing value - invalid literal; last read: '-0.0Z'; expected end of input", json::parse_error&);
621 "[json.exception.parse_error.101] parse error at line 1, column 7: syntax error while parsing value - unexpected ':'; expected end of input", json::parse_error&);
623 "[json.exception.parse_error.101] parse error at line 1, column 6: syntax error while parsing value - invalid number; expected digit after '-'; last read: '-:'; expected end of input", json::parse_error&);
625 "[json.exception.parse_error.101] parse error at line 1, column 5: syntax error while parsing value - invalid number; expected digit after exponent sign; last read: '-0e-:'", json::parse_error&);
627 "[json.exception.parse_error.101] parse error at line 1, column 4: syntax error while parsing value - invalid literal; last read: '-0f'; expected end of input", json::parse_error&);
898 "[json.exception.parse_error.101] parse error at line 1, column 3: syntax error while parsing value - invalid number; expected digit after '.'; last read: '0.'", json::parse_error&);
900 "[json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing value - invalid number; expected digit after '-'; last read: '-'", json::parse_error&);
902 "[json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing value - invalid number; expected digit after '-'; last read: '--'", json::parse_error&);
904 "[json.exception.parse_error.101] parse error at line 1, column 4: syntax error while parsing value - invalid number; expected digit after '.'; last read: '-0.'", json::parse_error&);
906 "[json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing value - invalid number; expected digit after '-'; last read: '-.'", json::parse_error&);
908 "[json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing value - invalid number; expected digit after '-'; last read: '-:'", json::parse_error&);
910 "[json.exception.parse_error.101] parse error at line 1, column 3: syntax error while parsing value - invalid number; expected digit after '.'; last read: '0.:'", json::parse_error&);
912 "[json.exception.parse_error.101] parse error at line 1, column 1: syntax error while parsing value - invalid literal; last read: 'e'", json::parse_error&);
914 "[json.exception.parse_error.101] parse error at line 1, column 3: syntax error while parsing value - invalid number; expected '+', '-', or digit after exponent; last read: '1e.'", json::parse_error&);
916 "[json.exception.parse_error.101] parse error at line 1, column 3: syntax error while parsing value - invalid number; expected '+', '-', or digit after exponent; last read: '1e/'", json::parse_error&);
918 "[json.exception.parse_error.101] parse error at line 1, column 3: syntax error while parsing value - invalid number; expected '+', '-', or digit after exponent; last read: '1e:'", json::parse_error&);
920 "[json.exception.parse_error.101] parse error at line 1, column 3: syntax error while parsing value - invalid number; expected '+', '-', or digit after exponent; last read: '1E.'", json::parse_error&);
922 "[json.exception.parse_error.101] parse error at line 1, column 3: syntax error while parsing value - invalid number; expected '+', '-', or digit after exponent; last read: '1E/'", json::parse_error&);
924 "[json.exception.parse_error.101] parse error at line 1, column 3: syntax error while parsing value - invalid number; expected '+', '-', or digit after exponent; last read: '1E:'", json::parse_error&);
928 "[json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing value - invalid literal; last read: 'n'", json::parse_error&);
930 "[json.exception.parse_error.101] parse error at line 1, column 3: syntax error while parsing value - invalid literal; last read: 'nu'", json::parse_error&);
932 "[json.exception.parse_error.101] parse error at line 1, column 4: syntax error while parsing value - invalid literal; last read: 'nul'", json::parse_error&);
934 "[json.exception.parse_error.101] parse error at line 1, column 4: syntax error while parsing value - invalid literal; last read: 'nulk'", json::parse_error&);
936 "[json.exception.parse_error.101] parse error at line 1, column 4: syntax error while parsing value - invalid literal; last read: 'nulm'", json::parse_error&);
940 "[json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing value - invalid literal; last read: 't'", json::parse_error&);
942 "[json.exception.parse_error.101] parse error at line 1, column 3: syntax error while parsing value - invalid literal; last read: 'tr'", json::parse_error&);
944 "[json.exception.parse_error.101] parse error at line 1, column 4: syntax error while parsing value - invalid literal; last read: 'tru'", json::parse_error&);
946 "[json.exception.parse_error.101] parse error at line 1, column 4: syntax error while parsing value - invalid literal; last read: 'trud'", json::parse_error&);
948 "[json.exception.parse_error.101] parse error at line 1, column 4: syntax error while parsing value - invalid literal; last read: 'truf'", json::parse_error&);
952 "[json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing value - invalid literal; last read: 'f'", json::parse_error&);
954 "[json.exception.parse_error.101] parse error at line 1, column 3: syntax error while parsing value - invalid literal; last read: 'fa'", json::parse_error&);
956 "[json.exception.parse_error.101] parse error at line 1, column 4: syntax error while parsing value - invalid literal; last read: 'fal'", json::parse_error&);
958 "[json.exception.parse_error.101] parse error at line 1, column 5: syntax error while parsing value - invalid literal; last read: 'fals'", json::parse_error&);
960 "[json.exception.parse_error.101] parse error at line 1, column 5: syntax error while parsing value - invalid literal; last read: 'falsd'", json::parse_error&);
962 "[json.exception.parse_error.101] parse error at line 1, column 5: syntax error while parsing value - invalid literal; last read: 'falsf'", json::parse_error&);
966 "[json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing value - unexpected end of input; expected '[', '{', or a literal", json::parse_error&);
968 "[json.exception.parse_error.101] parse error at line 1, column 3: syntax error while parsing array - unexpected end of input; expected ']'", json::parse_error&);
970 "[json.exception.parse_error.101] parse error at line 1, column 4: syntax error while parsing value - unexpected end of input; expected '[', '{', or a literal", json::parse_error&);
972 "[json.exception.parse_error.101] parse error at line 1, column 4: syntax error while parsing value - unexpected ']'; expected '[', '{', or a literal", json::parse_error&);
974 "[json.exception.parse_error.101] parse error at line 1, column 1: syntax error while parsing value - unexpected ']'; expected '[', '{', or a literal", json::parse_error&);
978 "[json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing object key - unexpected end of input; expected string literal", json::parse_error&);
980 "[json.exception.parse_error.101] parse error at line 1, column 7: syntax error while parsing object separator - unexpected end of input; expected ':'", json::parse_error&);
982 "[json.exception.parse_error.101] parse error at line 1, column 8: syntax error while parsing value - unexpected end of input; expected '[', '{', or a literal", json::parse_error&);
984 "[json.exception.parse_error.101] parse error at line 1, column 8: syntax error while parsing value - unexpected '}'; expected '[', '{', or a literal", json::parse_error&);
986 "[json.exception.parse_error.101] parse error at line 1, column 10: syntax error while parsing object key - unexpected '}'; expected string literal", json::parse_error&);
988 "[json.exception.parse_error.101] parse error at line 1, column 1: syntax error while parsing value - unexpected '}'; expected '[', '{', or a literal", json::parse_error&);
992 "[json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing value - invalid string: missing closing quote; last read: '\"'", json::parse_error&);
994 "[json.exception.parse_error.101] parse error at line 1, column 4: syntax error while parsing value - invalid string: missing closing quote; last read: '\"\\\"'", json::parse_error&);
996 "[json.exception.parse_error.101] parse error at line 1, column 4: syntax error while parsing value - invalid string: '\\u' must be followed by 4 hex digits; last read: '\"\\u\"'", json::parse_error&);
998 "[json.exception.parse_error.101] parse error at line 1, column 5: syntax error while parsing value - invalid string: '\\u' must be followed by 4 hex digits; last read: '\"\\u0\"'", json::parse_error&);
1000 "[json.exception.parse_error.101] parse error at line 1, column 6: syntax error while parsing value - invalid string: '\\u' must be followed by 4 hex digits; last read: '\"\\u01\"'", json::parse_error&);
1002 "[json.exception.parse_error.101] parse error at line 1, column 7: syntax error while parsing value - invalid string: '\\u' must be followed by 4 hex digits; last read: '\"\\u012\"'", json::parse_error&);
1004 "[json.exception.parse_error.101] parse error at line 1, column 4: syntax error while parsing value - invalid string: '\\u' must be followed by 4 hex digits; last read: '\"\\u'", json::parse_error&);
1006 "[json.exception.parse_error.101] parse error at line 1, column 5: syntax error while parsing value - invalid string: '\\u' must be followed by 4 hex digits; last read: '\"\\u0'", json::parse_error&);
1008 "[json.exception.parse_error.101] parse error at line 1, column 6: syntax error while parsing value - invalid string: '\\u' must be followed by 4 hex digits; last read: '\"\\u01'", json::parse_error&);
1010 "[json.exception.parse_error.101] parse error at line 1, column 7: syntax error while parsing value - invalid string: '\\u' must be followed by 4 hex digits; last read: '\"\\u012'", json::parse_error&);
1042 CHECK_THROWS_AS(parser_helper(s), json::parse_error&);
1047 "[json.exception.parse_error.101] parse error at line 1, column 3: syntax error while parsing value - invalid string: forbidden character after backslash; last read: '\"\\" + std::string(1, static_cast<char>(c)) + "'");
1118 CHECK_THROWS_AS(parser_helper(s1), json::parse_error&);
1123 "[json.exception.parse_error.101] parse error at line 1, column 7: syntax error while parsing value - invalid string: '\\u' must be followed by 4 hex digits; last read: '" + s1.substr(0, 7) + "'");
1127 CHECK_THROWS_AS(parser_helper(s2), json::parse_error&);
1132 "[json.exception.parse_error.101] parse error at line 1, column 6: syntax error while parsing value - invalid string: '\\u' must be followed by 4 hex digits; last read: '" + s2.substr(0, 6) + "'");
1136 CHECK_THROWS_AS(parser_helper(s3), json::parse_error&);
1141 "[json.exception.parse_error.101] parse error at line 1, column 5: syntax error while parsing value - invalid string: '\\u' must be followed by 4 hex digits; last read: '" + s3.substr(0, 5) + "'");
1145 CHECK_THROWS_AS(parser_helper(s4), json::parse_error&);
1150 "[json.exception.parse_error.101] parse error at line 1, column 4: syntax error while parsing value - invalid string: '\\u' must be followed by 4 hex digits; last read: '" + s4.substr(0, 4) + "'");
1156 json _;
1159 CHECK_THROWS_WITH_AS(_ = json::parse("\"\\uD80C\""), "[json.exception.parse_error.101] parse error at line 1, column 8: syntax error while parsing value - invalid string: surrogate U+D800..U+DBFF must be followed by U+DC00..U+DFFF; last read: '\"\\uD80C\"'", json::parse_error&);
1161 CHECK_THROWS_WITH_AS(_ = json::parse("\"\\uD80C\\uD80C\""),
1162 "[json.exception.parse_error.101] parse error at line 1, column 13: syntax error while parsing value - invalid string: surrogate U+D800..U+DBFF must be followed by U+DC00..U+DFFF; last read: '\"\\uD80C\\uD80C'", json::parse_error&);
1163 CHECK_THROWS_WITH_AS(_ = json::parse("\"\\uD80C\\u0000\""),
1164 "[json.exception.parse_error.101] parse error at line 1, column 13: syntax error while parsing value - invalid string: surrogate U+D800..U+DBFF must be followed by U+DC00..U+DFFF; last read: '\"\\uD80C\\u0000'", json::parse_error&);
1165 CHECK_THROWS_WITH_AS(_ = json::parse("\"\\uD80C\\uFFFF\""),
1166 "[json.exception.parse_error.101] parse error at line 1, column 13: syntax error while parsing value - invalid string: surrogate U+D800..U+DBFF must be followed by U+DC00..U+DFFF; last read: '\"\\uD80C\\uFFFF'", json::parse_error&);
1250 CHECK(json::parser(nlohmann::detail::input_adapter(s)).accept());
1263 CHECK(json::parser(nlohmann::detail::input_adapter(s)).accept() == false);
1322 CHECK(json::parser(nlohmann::detail::input_adapter(s1)).accept());
1324 CHECK(json::parser(nlohmann::detail::input_adapter(s2)).accept());
1326 CHECK(json::parser(nlohmann::detail::input_adapter(s3)).accept());
1328 CHECK(json::parser(nlohmann::detail::input_adapter(s4)).accept());
1333 CHECK(json::parser(nlohmann::detail::input_adapter(s1)).accept() == false);
1336 CHECK(json::parser(nlohmann::detail::input_adapter(s2)).accept() == false);
1339 CHECK(json::parser(nlohmann::detail::input_adapter(s3)).accept() == false);
1342 CHECK(json::parser(nlohmann::detail::input_adapter(s4)).accept() == false);
1358 CHECK_THROWS_WITH_AS(parser_helper("{,\"key\": false}"), "[json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing object key - unexpected ','; expected string literal", json::parse_error&);
1360 CHECK_THROWS_WITH_AS(parser_helper("[{\"key\": false true]"), "[json.exception.parse_error.101] parse error at line 1, column 19: syntax error while parsing object - unexpected true literal; expected '}'", json::parse_error&);
1364 json::parser_callback_t cb = [](int /*unused*/, json::parse_event_t event, json& /*unused*/) noexcept
1366 return event != json::parse_event_t::key;
1369 json x = json::parse("{\"key\": false}", cb);
1370 CHECK(x == json::object());
1403 json j_object = json::parse(s_object, [](int /*unused*/, json::parse_event_t /*unused*/, const json& /*unused*/) noexcept
1408 CHECK (j_object == json({{"foo", 2}, {"bar", {{"baz", 1}}}}));
1410 json j_array = json::parse(s_array, [](int /*unused*/, json::parse_event_t /*unused*/, const json& /*unused*/) noexcept
1415 CHECK (j_array == json({1, 2, {3, 4, 5}, 4, 5}));
1420 json j_object = json::parse(s_object, [](int /*unused*/, json::parse_event_t /*unused*/, const json& /*unused*/) noexcept
1428 json j_array = json::parse(s_array, [](int /*unused*/, json::parse_event_t /*unused*/, const json& /*unused*/) noexcept
1439 json j_object = json::parse(s_object, [](int /*unused*/, json::parse_event_t event, const json & j) noexcept
1442 return event != json::parse_event_t::value || j != json(2);
1445 CHECK (j_object == json({{"bar", {{"baz", 1}}}}));
1447 json j_array = json::parse(s_array, [](int /*unused*/, json::parse_event_t event, const json & j) noexcept
1449 return event != json::parse_event_t::value || j != json(2);
1452 CHECK (j_array == json({1, {3, 4, 5}, 4, 5}));
1457 json j_filtered1 = json::parse(structured_array, [](int /*unused*/, json::parse_event_t e, const json & parsed)
1459 return !(e == json::parse_event_t::object_end && parsed.contains("foo"));
1464 CHECK (j_filtered1 == json({1, {{"qux", "baz"}}}));
1466 json j_filtered2 = json::parse(structured_array, [](int /*unused*/, json::parse_event_t e, const json& /*parsed*/) noexcept
1468 return e != json::parse_event_t::object_end;
1473 CHECK (j_filtered2 == json({1}));
1481 json j_object = json::parse(s_object, [](int /*unused*/, json::parse_event_t e, const json& /*unused*/) noexcept
1484 if (e == json::parse_event_t::object_end && first)
1494 CHECK (j_object == json({{"foo", 2}}));
1498 json j_array = json::parse(s_array, [](int /*unused*/, json::parse_event_t e, const json& /*unused*/) noexcept
1501 if (e == json::parse_event_t::array_end && first)
1511 CHECK (j_array == json({1, 2, 4, 5}));
1522 json j_empty_object = json::parse("{}", [](int /*unused*/, json::parse_event_t e, const json& /*unused*/) noexcept
1524 return e != json::parse_event_t::object_end;
1526 CHECK(j_empty_object == json());
1528 json j_empty_array = json::parse("[]", [](int /*unused*/, json::parse_event_t e, const json& /*unused*/) noexcept
1530 return e != json::parse_event_t::array_end;
1532 CHECK(j_empty_array == json());
1541 json j;
1542 json::parser(nlohmann::detail::input_adapter(std::begin(v), std::end(v))).parse(true, j);
1543 CHECK(j == json(true));
1549 json j;
1550 json::parser(nlohmann::detail::input_adapter(std::begin(v), std::end(v))).parse(true, j);
1551 CHECK(j == json(true));
1557 json j;
1558 json::parser(nlohmann::detail::input_adapter(std::begin(v), std::end(v))).parse(true, j);
1559 CHECK(j == json(true));
1564 CHECK(parser_helper("true") == json(true));
1570 json j;
1571 json::parser(nlohmann::detail::input_adapter(std::begin(v), std::end(v))).parse(true, j);
1572 CHECK(j == json(true));
1578 json j;
1579 json::parser(nlohmann::detail::input_adapter(std::begin(v), std::end(v))).parse(true, j);
1580 CHECK(j == json(true));
1586 json j;
1587 json::parser(nlohmann::detail::input_adapter(std::begin(v), std::end(v))).parse(true, j);
1588 CHECK(j == json(true));
1596 json::parser_callback_t cb = [](int /*unused*/, json::parse_event_t /*unused*/, json& /*unused*/) noexcept
1601 CHECK(json::parse("{\"foo\": true:", cb, false).is_discarded());
1603 json _;
1604 CHECK_THROWS_WITH_AS(_ = json::parse("{\"foo\": true:", cb), "[json.exception.parse_error.101] parse error at line 1, column 13: syntax error while parsing object - unexpected ':'; expected '}'", json::parse_error&);
1606 CHECK_THROWS_WITH_AS(_ = json::parse("1.18973e+4932", cb), "[json.exception.out_of_range.406] number overflow parsing '1.18973e+4932'", json::out_of_range&);
1614 CHECK(json::sax_parse("{}", &s) == false);
1620 CHECK(json::sax_parse("{\"k1\": true}", &s) == false);
1626 CHECK(json::sax_parse("{\"k1\": true, \"k2\": false}", &s) == false);
1632 CHECK(json::sax_parse("[]", &s) == false);
1638 CHECK(json::sax_parse("[1]", &s) == false);
1644 CHECK(json::sax_parse("3.14", &s) == false);
1650 CHECK(json::sax_parse("false", &s) == false);
1656 CHECK(json::sax_parse("null", &s) == false);
1662 CHECK(json::sax_parse("true", &s) == false);
1668 CHECK(json::sax_parse("12", &s) == false);
1674 CHECK(json::sax_parse("-12", &s) == false);
1680 CHECK(json::sax_parse("\"foo\"", &s) == false);
1687 json _;
1688 CHECK_THROWS_WITH_AS(_ = json::parse("/a", nullptr, true, true), "[json.exception.parse_error.101] parse error at line 1, column 2: syntax error while parsing value - invalid comment; expecting '/' or '*' after '/'; last read: '/a'", json::parse_error);
1689 CHECK_THROWS_WITH_AS(_ = json::parse("/*", nullptr, true, true), "[json.exception.parse_error.101] parse error at line 1, column 3: syntax error while parsing value - invalid comment; missing closing '*/'; last read: '/*<U+0000>'", json::parse_error);