Loading ...
Sorry, an error occurred while loading the content.

Re: Stripping comments from JSON.

Expand Messages
  • Dave Gamble
    ... anyone to do anything stupid, since the Parse function remains equally strict. Cheers! Dave. ... [Non-text portions of this message have been removed]
    Message 1 of 6 , May 26, 2013
    • 0 Attachment
      On Sunday, May 26, 2013, douglascrockford wrote:

      > **
      >
      >
      > --- In json@yahoogroups.com <javascript:_e({}, 'cvml',
      > 'json%40yahoogroups.com');>, Dave Gamble <davegamble@...> wrote:
      > > > --- In json@yahoogroups.com <javascript:_e({}, 'cvml',
      > 'json%40yahoogroups.com');> <javascript:_e({}, 'cvml',
      > > > 'json%40yahoogroups.com');>, Dave Gamble <davegamble@> wrote:
      > > > > Will be very appreciative of any thought/feedback on the matter.
      > Sorry if
      > > > > this one has come up before and I've not seen the thread.
      > > >
      > > > Have you read the JSON RFC? http://www.ietf.org/rfc/rfc4627.txt
      > > >
      > > > Of course. However, in the wild, there appears (and this may in fact
      > not
      > > be the case, and the root of my confusion) to be consensus that parsers
      > > should "keep JSON pure", and reject comments.
      > >
      > > I understand that according to the RFC parsing comments natively is
      > > acceptable, but it seems to be generally frowned upon.
      >
      > ECMAScript's JSON.parse is very strict. The design assumption was that if
      > you allow web developers to do something really stupid, many of them will.
      > So a lenient JSON parser in JavaScript would effectively break JSON
      > compatibility with other languages.
      >
      >
      > Ok. That makes sense. The method I'm proposing really doesn't encourage
      anyone to do anything stupid, since the Parse function remains equally
      strict.

      Cheers!

      Dave.





      >
      >


      [Non-text portions of this message have been removed]
    • Jonathan Wallace
      Many libraries have support for comments. Libjson for example supports /* c comments */, //c++ comments, and #bash comments Sent from my iPhone
      Message 2 of 6 , May 26, 2013
      • 0 Attachment
        Many libraries have support for comments. Libjson for example supports /* c comments */, //c++ comments, and #bash comments

        Sent from my iPhone

        On May 26, 2013, at 10:13, Dave Gamble <davegamble@...> wrote:

        > On Sunday, May 26, 2013, douglascrockford wrote:
        >
        >> **
        >>
        >>
        >> --- In json@yahoogroups.com <javascript:_e({}, 'cvml',
        >> 'json%40yahoogroups.com');>, Dave Gamble <davegamble@...> wrote:
        >>>> --- In json@yahoogroups.com <javascript:_e({}, 'cvml',
        >> 'json%40yahoogroups.com');> <javascript:_e({}, 'cvml',
        >>>> 'json%40yahoogroups.com');>, Dave Gamble <davegamble@> wrote:
        >>>>> Will be very appreciative of any thought/feedback on the matter.
        >> Sorry if
        >>>>> this one has come up before and I've not seen the thread.
        >>>>
        >>>> Have you read the JSON RFC? http://www.ietf.org/rfc/rfc4627.txt
        >>>>
        >>>> Of course. However, in the wild, there appears (and this may in fact
        >> not
        >>> be the case, and the root of my confusion) to be consensus that parsers
        >>> should "keep JSON pure", and reject comments.
        >>>
        >>> I understand that according to the RFC parsing comments natively is
        >>> acceptable, but it seems to be generally frowned upon.
        >>
        >> ECMAScript's JSON.parse is very strict. The design assumption was that if
        >> you allow web developers to do something really stupid, many of them will.
        >> So a lenient JSON parser in JavaScript would effectively break JSON
        >> compatibility with other languages.
        >>
        >>
        >> Ok. That makes sense. The method I'm proposing really doesn't encourage
        > anyone to do anything stupid, since the Parse function remains equally
        > strict.
        >
        > Cheers!
        >
        > Dave.
        >
        >
        >
        >
        >
        >>
        >>
        >
        >
        > [Non-text portions of this message have been removed]
        >
        >
        >
        > ------------------------------------
        >
        > Yahoo! Groups Links
        >
        >
        >
      Your message has been successfully submitted and would be delivered to recipients shortly.