The reason for this "escapes"
me.
rel="noreferrer">JSON escapes the forward slash, so a hash {a:
is serialized as
"a/b/c"}{"a":"a\/b\/c"}
instead
of
{"a":"a/b/c"}
.
Why?
The reason for this "escapes"
me.
rel="noreferrer">JSON escapes the forward slash, so a hash {a:
is serialized as
"a/b/c"}{"a":"a\/b\/c"}
instead
of
{"a":"a/b/c"}
.
Why?
Answer
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
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)
I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...
No comments:
Post a Comment