JSON: why are forward slashes escaped?

前端 未结 5 981
一整个雨季
一整个雨季 2020-11-21 23:59

The reason for this \"escapes\" me.

JSON escapes the forward slash, so a hash {a: \"a/b/c\"} is serialized as {\"a\":\"a\\/b\\/c\"} instead

5条回答
  •  离开以前
    2020-11-22 00:33

    Ugly PHP!

    The JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES must be default, not an (strange) option... How to say it to php-developers?

    The default MUST be the most frequent use, and the (current) most widely used standards as UTF8. How many PHP-code fragments in the Github or other place need this exoctic "embedded in HTML" feature?

提交回复
热议问题