JSON: why are forward slashes escaped?

前端 未结 5 1067
一整个雨季
一整个雨季 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条回答
  •  猫巷女王i
    2020-11-22 00:36

    PHP escapes forward slashes by default which is probably why this appears so commonly. I'm not sure why, but possibly because embedding the string "" inside a

提交回复
热议问题