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"}.
Why?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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, like Harold L points out:
Allowing
\/helps when embedding JSON in a<script>tag, which doesn’t allow</inside strings, like Seb points out:Some of Microsoft’s ASP.NET Ajax/JSON API’s use this loophole to add extra information, e.g., a datetime will be sent as
"\/Date(milliseconds)\/". (Yuck)