On Thu, Feb 4, 2016 at 11:04 AM, Dominique Devienne <ddevienne at gmail.com>
wrote:

> \" represents the quotation mark character (U+0022).
> \\ represents the reverse solidus character (U+005C).
> \/ represents the solidus character (U+002F).
> ...
> The wording above doesn't seem to "require" these characters to be escaped.
> Only double-quote, and backlash need to be.
> My own JSON serializer does, but the spec doesn't require it apparently. So
> json1 seems OK and to-spec...
>

FWIW, i once asked Doug Crockford about must-vs-may here and he responded:

        --------------
        From: Douglas Crockford <douglas at crockford.com>
        To: Stephan Beal <sgbeal at googlemail.com>
        Subject: Re: Is escaping of forward slashes required?

        It is allowed, not required. It is allowed so that JSON can be
safely
        embedded in HTML, which can freak out when seeing strings containing
        "</". JSON tolerates "<\/" for this reason.

        On 4/8/2011 2:09 PM, Stephan Beal wrote:
        > Hello, Jsonites,
        >
        > i'm a bit confused on a small grammatic detail of JSON:
        >
        > if i'm reading the grammar chart on http://www.json.org/
correctly,
        > forward slashes (/) are supposed to be escaped in JSON. However,
the
        > JSON class provided with my browsers (Chrome and FF, both of
which i
        > assume are fairly standards/RFC-compliant) do not escape such
characters.
        >
        > Is backslash-escaping forward slashes required? If so, what is the
        > justification for it? (i ask because i find it unnecessary and
hard to
        > look at.)


-- 
----- stephan beal
http://wanderinghorse.net/home/stephan/
http://gplus.to/sgbeal
"Freedom is sloppy. But since tyranny's the only guaranteed byproduct of
those who insist on a perfect world, freedom will have to do." -- Bigby Wolf

Reply via email to