“<” character in JSON data is serialized to \u003c

后端 未结 1 1283
面向向阳花
面向向阳花 2020-12-11 17:55

I have a JSON object where the value of one element is a string. In this string there are the characters \"\". I take this entire JSON object and i

1条回答
  •  囚心锁ツ
    2020-12-11 18:05

    The characters are being encoded "properly"!1 Use a working JSON library to correctly access the JSON data - it is a valid JSON encoding.

    Escaping these characters prevents HTML injection via JSON - and makes the JSON XML-friendly. That is, even if the JSON is emited directly into JavaScript (as is done fairly often as JSON is a valid2 subset of JavaScript), it cannot be used to terminate the

提交回复
热议问题