Lines Matching full:json
2 // __| | __| | | | JSON for Modern C++ (supporting code)
4 // |_____|_____|_____|_|___| https://github.com/nlohmann/json
11 // for some reason including this after the json header leads to linker errors with VS 2017...
13 #include <nlohmann/json.hpp>
14 using nlohmann::json;
78 json _;
79 CHECK_NOTHROW(_ = json::parse(json_text));
87 json _;
89 CHECK_THROWS_WITH_AS(_ = json::parse("\"\\uDC00\\uDC00\""), "[json.exception.parse_error.101] parse error at line 1, column 7: syntax error while parsing value - invalid string: surrogate U+DC00..U+DFFF must follow U+D800..U+DBFF; last read: '\"\\uDC00'", json::parse_error&);
91 CHECK_THROWS_WITH_AS(_ = json::parse("\"\\uD7FF\\uDC00\""), "[json.exception.parse_error.101] parse error at line 1, column 13: syntax error while parsing value - invalid string: surrogate U+DC00..U+DFFF must follow U+D800..U+DBFF; last read: '\"\\uD7FF\\uDC00'", json::parse_error&);
93 CHECK_THROWS_WITH_AS(_ = json::parse("\"\\uD800]\""), "[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: '\"\\uD800]'", json::parse_error&);
95 CHECK_THROWS_WITH_AS(_ = json::parse("\"\\uD800\\v\""), "[json.exception.parse_error.101] parse error at line 1, column 9: syntax error while parsing value - invalid string: surrogate U+D800..U+DBFF must be followed by U+DC00..U+DFFF; last read: '\"\\uD800\\v'", json::parse_error&);
97 CHECK_THROWS_WITH_AS(_ = json::parse("\"\\uD800\\u123\""), "[json.exception.parse_error.101] parse error at line 1, column 13: syntax error while parsing value - invalid string: '\\u' must be followed by 4 hex digits; last read: '\"\\uD800\\u123\"'", json::parse_error&);
99 CHECK_THROWS_WITH_AS(_ = json::parse("\"\\uD800\\uDBFF\""), "[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: '\"\\uD800\\uDBFF'", json::parse_error&);
101 CHECK_THROWS_WITH_AS(_ = json::parse("\"\\uD800\\uE000\""), "[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: '\"\\uD800\\uE000'", json::parse_error&);
116 CHECK_THROWS_AS(json::parse(json_text), json::parse_error&);
135 CHECK_THROWS_AS(json::parse(json_text), json::parse_error&);
148 CHECK_THROWS_AS(json::parse(json_text), json::parse_error&);
159 // strings in a JSON array
160 std::ifstream f(TEST_DATA_DIRECTORY "/json_nlohmann_tests/all_unicode.json");
161 json j;
169 SECTION("check JSON Pointers")
173 // skip non-string JSON values
187 // JSON Pointers must begin with "/"
190 CHECK_NOTHROW(json::json_pointer("/" + ptr));
205 std::ifstream f(TEST_DATA_DIRECTORY "/json_nlohmann_tests/bom.json");
206 json j;
213 json _;
214 CHECK_NOTHROW(_ = json::parse(i.begin(), i.end()));
220 json _;
221 CHECK_THROWS_AS(_ = json::parse("\xef\xbb"), json::parse_error&);
222 CHECK_THROWS_AS(_ = json::parse("\xef\xbb\xbb"), json::parse_error&);
233 json _;
235 // create JSON string value
236 json j = s;
237 // create JSON text
248 // parsing JSON text succeeds
249 CHECK_NOTHROW(_ = json::parse(ps));
253 CHECK_NOTHROW(_ = json::parse(j.dump()));
256 json jr = json::parse(j.dump());
262 CHECK_THROWS_AS(j.dump(), json::type_error&);
264 // parsing JSON text fails
265 CHECK_THROWS_AS(_ = json::parse(ps), json::parse_error&);