1
0
mirror of https://github.com/nlohmann/json.git synced 2025-07-28 12:02:00 +03:00

📝 updated documentation #1314

This commit is contained in:
Niels Lohmann
2018-10-24 09:28:57 +02:00
parent 7b501de054
commit f102df3cba
4 changed files with 12 additions and 4 deletions

View File

@ -30,7 +30,7 @@ int main()
<< j_string.dump(-1, ' ', true) << '\n';
// create JSON value with invalid UTF-8 byte sequence
json j_invalid = "\xF0\xA4\xAD\xC0";
json j_invalid = "ä\xA9ü";
try
{
std::cout << j_invalid.dump() << std::endl;
@ -39,4 +39,10 @@ int main()
{
std::cout << e.what() << std::endl;
}
std::cout << "string with replaced invalid characters: "
<< j_invalid.dump(-1, ' ', false, json::error_handler_t::replace)
<< "\nstring with ignored invalid characters: "
<< j_invalid.dump(-1, ' ', false, json::error_handler_t::ignore)
<< '\n';
}

View File

@ -1 +1 @@
<a target="_blank" href="https://wandbox.org/permlink/uC4kna7QsQ0rAt80"><b>online</b></a>
<a target="_blank" href="https://wandbox.org/permlink/KtH6hJIe10abhHMi"><b>online</b></a>

View File

@ -50,4 +50,6 @@ arrays:
strings:
"Hellö 😀!"
"Hell\u00f6 \ud83d\ude00!"
[json.exception.type_error.316] invalid UTF-8 byte at index 3: 0xC0
[json.exception.type_error.316] invalid UTF-8 byte at index 2: 0xA9
string with replaced invalid characters: "ä<>ü"
string with ignored invalid characters: "äü"