JSON: why are forward slashes escaped?

前端 未结 5 1065
一整个雨季
一整个雨季 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:15

    JSON doesn't require you to do that, it allows you to do that. It also allows you to use "\u0061" for "A", but it's not required. Allowing \/ helps when embedding JSON in a

提交回复
热议问题