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

Re: [json] never mind the backslash. a double-quote dies. Where is the outrage?

Expand Messages
  • 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 1 of 13 , Aug 2 9:35 PM
    • 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 2 of 13 , Aug 2 9:50 PM
      • 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 3 of 13 , Aug 2 9:55 PM
        • 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 4 of 13 , Aug 2 11:24 PM
          • 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 5 of 13 , Aug 3 4:07 AM
            • 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 6 of 13 , Aug 3 9:20 AM
              • 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 7 of 13 , Aug 6 3:58 PM
                • 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.