I got this strange message when parsing a json configuration file:
"JsonReaderException: '0xEF' is an invalid escapable character within a JSON string. The string should be correctly escaped. LineNumber: 3 | BytePositionInLine: 11."
The content of the json file is:
{
"books": {
"Content": [
"運作"
]
}
}
There is no such char '0xEF' in the configuration file, and nothing to escape.
The C# code as following:
using Microsoft.Extensions.Configuration;
// ...
config = new ConfigurationBuilder()
.AddJsonFile(Path.Combine(Directory.GetCurrentDirectory(), "config.json"))
.Build();
Any help would be appreciated.
Note:
as I memtioned above, "there is no such char '0xEF' in the configuration file", but the message is showing "'0xEF' is an invalid escapable character within a JSON string". Where does it come from?
The configuration file is the right file, all information posted above are double confirmed.
The byte representaion of the word 運作 is: byte[] { 0xff 0xfe 0x4b 0x90 0x5c 0x4f }.
The issue is created by the word "運", all other words are working fine. Is there certain words are not allowed as string in json file?