[json.exception.parse_error.101] parse error at line 1, column 4520: syntax error while parsing value - invalid string: forbidden character after backslash; last read: '".\?
181404010226 opened this issue · comments
Description
I encountered an error while trying to load the JSON shown below. The error occurred at the position highlighted in blue.
The json file:
tileset.json
This is a 3D Tiles project where I convert strings to UTF-8 to ensure JSON exports correctly. Without this conversion, I encounter an error labeled "invalid UTF-8 byte at index." The image below shows the problematic string in debug mode.
Reproduction steps
when load the json file it happened.
Expected vs. actual results
I expected it successed loaded.
Minimal code example
json childJson;
try {
file >> childJson;
}
catch (const json::parse_error& e) {
std::cerr << "\033[1;31mERROR!\033[0m JSON parse error in file " << entry.path() << ": " << e.what() << std::endl;
file.close();
return; // 中断程序
}
file.close();
Error messages
ERROR! JSON parse error in file "C:\\Users\\Administrator\\Desktop\\Data\\temp\\开元通宝及广场\\tileset.json": [json.exception.parse_error.101] parse error at line 1, column 4520: syntax error while parsing value - invalid string: forbidden character after backslash; last read: '".\?
Compiler and operating system
Microsoft Visual C++ 2022,windows10
Library version
3.10.4
Validation
- The bug also occurs if the latest version from the
develop
branch is used. - I can successfully compile and run the unit tests.
I think the string ".\开元通宝及广场" itself does not comply with the JSON specification. When exported, it should be ".\\开元通宝及广场" to comply with the specification.