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

never mind the backslash. a double-quote dies. Where is the outrage?

Expand Messages
  • jonschull5
    I don t understand why this isn t considered a serious flaw in JSON... For any object o, it should be true that json.read( json.write(o) ) == o But this is not
    Message 1 of 13 , Aug 2, 2005
    • 0 Attachment
      I don't understand why this isn't considered a serious flaw in JSON...

      For any object o, it should be true that

      json.read( json.write(o) ) == o

      But this is not true for the object {'a':' " '}

      ???????????

      A similarly fatal problem arises when I try to jsonize some a DOM
      element that includes an onclick method with a quoted argument. This
      is not an improbable use case.

      Is there no solution?
    • jonschull5
      P.S. I ve determined that Crockford s javascript parser does not have this problem (which I found in patrick logan s json.py). With javascript, o2= son.parse(
      Message 2 of 13 , Aug 2, 2005
      • 0 Attachment
        P.S. I've determined that Crockford's javascript parser does not have
        this problem (which I found in patrick logan's json.py).

        With javascript,

        o2= son.parse( json.stringify(o) )
        o2.a == o.a is TRUE
        and o2.toSource()==o.ToSource() is also TRUE


        (interestingly...
        json.parse( json.stringify(o) ) == o fails
        but that's another story, I think )

        --- In json@yahoogroups.com, "jonschull5" <schull@d...> wrote:
        > I don't understand why this isn't considered a serious flaw in JSON...
        >
        > For any object o, it should be true that
        >
        > json.read( json.write(o) ) == o
        >
        > But this is not true for the object {'a':' " '}
        >
        > ???????????
        >
        > A similarly fatal problem arises when I try to jsonize some a DOM
        > element that includes an onclick method with a quoted argument. This
        > is not an improbable use case.
        >
        > Is there no solution?
      • Martin Cooper
        ... I m not sure which implementation you re referring to, since JSON is just a spec, but I m surprised the above even parses as valid JSON. Strings in JSON
        Message 3 of 13 , Aug 2, 2005
        • 0 Attachment
          On 8/2/05, jonschull5 <schull@...> wrote:
          > I don't understand why this isn't considered a serious flaw in JSON...
          >
          > For any object o, it should be true that
          >
          > json.read( json.write(o) ) == o
          >
          > But this is not true for the object {'a':' " '}

          I'm not sure which implementation you're referring to, since JSON is
          just a spec, but I'm surprised the above even parses as valid JSON.
          Strings in JSON must be surrounded by double quotes, and single quotes
          are not valid.

          --
          Martin Cooper


          > ???????????
          >
          > A similarly fatal problem arises when I try to jsonize some a DOM
          > element that includes an onclick method with a quoted argument. This
          > is not an improbable use case.
          >
          > Is there no solution?
          >
          >
          >
          >
          >
          >
          >
          >
          > Yahoo! Groups Links
          >
          >
          >
          >
          >
          >
          >
        • Jon Schull
          Ok, I should have said a serious flaw in the json.py library And it turns out to be a problem in the two python libraries I ve looked at
          Message 4 of 13 , Aug 2, 2005
          • 0 Attachment
            Ok, I should have said "a serious flaw in the json.py library"

            And it turns out to be a problem in the two python libraries I've
            looked at
            (https://sourceforge.net/projects/json-py/ and http://python.ca/nas/
            log/)

            I'm surprised the requirement that strings be surrounded by double
            quotes applies to the objects themselves. I don't think we can
            always control the quoting of nested expressions....


            =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
            Jon Schull, Ph.D.
            Associate Professor
            Information Technology
            Rochester Institute of Technology
            102 Lomb Memorial Drive
            Rochester, New York 14623
            schull@... 585-738-6696

            On Aug 3, 2005, at 12:35 AM, Martin Cooper wrote:

            > On 8/2/05, jonschull5 <schull@...> wrote:
            > > I don't understand why this isn't considered a serious flaw in
            > JSON...
            > >
            > > For any object o, it should be true that
            > >
            > > json.read( json.write(o) ) == o
            > >
            > > But this is not true for the object {'a':' " '}
            >
            > I'm not sure which implementation you're referring to, since JSON is
            > just a spec, but I'm surprised the above even parses as valid JSON.
            > Strings in JSON must be surrounded by double quotes, and single quotes
            > are not valid.
            >
            > --
            > Martin Cooper
            >
            >
            > > ???????????
            > >
            > > A similarly fatal problem arises when I try to jsonize some a DOM
            > > element that includes an onclick method with a quoted argument.
            > This
            > > is not an improbable use case.
            > >
            > > Is there no solution?
            > >
            > >
            > >
            > >
            > >
            > >
            > >
            > >
            > > Yahoo! Groups Links
            > >
            > >
            > >
            > >
            > >
            > >
            > >
            >
            >
            > SPONSORED LINKS
            > Json Programming languages Format
            > Computer security Computer training Large format
            >
            > YAHOO! GROUPS LINKS
            >
            > Visit your group "json" on the web.
            >
            > To unsubscribe from this group, send an email to:
            > json-unsubscribe@yahoogroups.com
            >
            > Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
            >
            >



            [Non-text portions of this message have been removed]
          • Michal Migurski
            ... The json.py library definitely has some problems. I ve found a few flaws in the way it encodes strings, which I ve sent back to Patrick as patches. I m
            Message 5 of 13 , Aug 2, 2005
            • 0 Attachment
              > Ok, I should have said "a serious flaw in the json.py library"

              The json.py library definitely has some problems. I've found a few
              flaws in the way it encodes strings, which I've sent back to Patrick
              as patches. I'm only using write() method.

              -mike.

              ------------------------------------------------------
              michal migurski- contact info, blog, and pgp key:
              sf/ca http://mike.teczno.com/contact.html
            • Mark Miller
              ... In E, this gives a syntax error as it should: ? term`{ a : }` # syntax error: # { a : } # ^ -- Text by me above is hereby placed in
              Message 6 of 13 , Aug 2, 2005
              • 0 Attachment
                jonschull5 wrote:
                > I don't understand why this isn't considered a serious flaw in JSON...
                >
                > For any object o, it should be true that
                >
                > json.read( json.write(o) ) == o
                >
                > But this is not true for the object {'a':' " '}

                In E, this gives a syntax error as it should:

                ? term`{'a':' " '}`
                # syntax error:
                # {'a':' " '}
                # ^

                --
                Text by me above is hereby placed in the public domain

                Cheers,
                --MarkM
              • jemptymethod
                Since it s Python, an option might be to access Mr Crockford s Java implementation of JSON, via Jython.
                Message 7 of 13 , Aug 3, 2005
                • 0 Attachment
                  Since it's Python, an option might be to access Mr Crockford's Java
                  implementation of JSON, via Jython.

                  --- In json@yahoogroups.com, Michal Migurski <mike-jsonphp@t...> wrote:
                  > > Ok, I should have said "a serious flaw in the json.py library"
                  >
                  > The json.py library definitely has some problems. I've found a few
                  > flaws in the way it encodes strings, which I've sent back to Patrick
                  > as patches. I'm only using write() method.
                  >
                  > -mike.
                  >
                  > ------------------------------------------------------
                  > michal migurski- contact info, blog, and pgp key:
                  > sf/ca http://mike.teczno.com/contact.html
                • Patrick D. Logan
                  oops. Editing error from the Python interpreter. The resulting json representation should look something like... { a : } -Patrick [Non-text portions of
                  Message 8 of 13 , Aug 3, 2005
                  • 0 Attachment
                    oops. Editing error from the Python interpreter. The resulting json representation should look something like...

                    {"a":" \" "}

                    -Patrick


                    [Non-text portions of this message have been removed]
                  • jonschull5
                    Just thought I d put it on record that both Patrick Logan and Neil Schemenauer promptly fixed and updated their python json libraries. Logan:
                    Message 9 of 13 , Aug 6, 2005
                    • 0 Attachment
                      Just thought I'd put it on record that both Patrick Logan and Neil
                      Schemenauer promptly fixed and updated their python json libraries.
                      Logan: https://sourceforge.net/projects/json-py/
                      Schemenauer: http://arctrix.com/nas/python/json-1.1.tar.gz

                      While they have slightly different output formats (Neil's is more
                      verbose, but more human-readable) they seem to be interoperable with
                      each other and with Crockford's javascript library (which is as it
                      should be).

                      Thanks to all!

                      Jon
                      http://jonschull.blogspot.com
                    Your message has been successfully submitted and would be delivered to recipients shortly.