Parse JSON C# Error

后端 未结 1 1349
北恋
北恋 2021-01-07 08:46

I\'m try to getting JSON data but getting Error.

Unexpected character encountered while parsing value: . Path \'\', line 0, position 0.

相关标签:
1条回答
  • 2021-01-07 09:44

    The downloaded string starts with two byte order marks (U+FEFF), which JSON.NET parser (correctly) doesn't understand.

    The reason why the downloaded string contains two BOMs is because the data your service is sending contains 3 of them. The first one is removed automatically by UTF-8 encoding, but the two other remain.

    BOM can be useful with files, where you can't store the charset used. But you are sending the charset used in a header, so you don't need to send BOM at all. And sending three of them is certainly incorrect.

    I believe this is caused by BOMs in your PHP files, so you should probably remove them from there.

    0 讨论(0)
提交回复
热议问题