Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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 of {"a":"a/b/c"} .(JSON转义为正斜杠,因此哈希{a: "a/b/c"}被序列化为{"a":"a\/b\/c"}而不是{"a":"a/b/c"} 。)

Why?(为什么?)

  ask by Jason S translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
410 views
Welcome To Ask or Share your Answers For Others

1 Answer

JSON doesn't require you to do that, it allows you to do that.(JSON不需要您执行此操作,而是允许您执行此操作。)

It also allows you to use "a" for "A", but it's not required.(它还允许您将“ \ u0061”用于“ A”,但这不是必需的。) Allowing \/ helps when embedding JSON in a <script> tag, which doesn't allow </ inside strings, like Seb points out.(当将JSON嵌入<script>标记(不允许</内时,允许\/有助于在字符串中嵌入</ ,就像Seb指出的那样。)

Some of Microsoft's ASP.NET Ajax/JSON API's use this loophole to add extra information, eg, a datetime will be sent as "\/Date(milliseconds)\/" .(Microsoft的某些ASP.NET Ajax / JSON API使用此漏洞来添加额外的信息,例如,日期时间将以"\/Date(milliseconds)\/" 。)

(Yuck)((Y))

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...