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

Re: [json] Re: JSON text not parsing on FireFox

Expand Messages
  • Michal Migurski
    ... It would be helpful to have some more context; the first snippet you sent was just plain old Javascript, and didn t show how you re using eval(). -mike.
    Message 1 of 11 , Jun 15, 2006
    • 0 Attachment
      > My understanding of JSON was that you need to form a Text in such way
      > that, when we create a JSON object using 'eval', then we can
      > traverse its properties using aJSONObject.attributeName.
      > So instead of returning XML and parsing it (which i have done before
      > in javascript ), i am returning this text and then converting it
      > into a JSON object.
      > Am i thinking wrong! Please correct me.
      It would be helpful to have some more context; the first snippet you
      sent was just plain old Javascript, and didn't show how you're using
      eval().

      -mike.

      ------------------------------------------------------
      michal migurski- contact info, blog, and pgp key:
      sf/ca http://mike.teczno.com/contact.html
    • Matthew Morley
      Perhaps he is asking why you aren t using: http://json.org/json.js ... string.parseJSON() This method parses a JSON text to produce an object or array. It will
      Message 2 of 11 , Jun 15, 2006
      • 0 Attachment
        Perhaps he is asking why you aren't using:

        http://json.org/json.js
        -----------------------------------------------------
        string.parseJSON()

        This method parses a JSON text to produce an object or
        array. It will return false if there is an error.
        --
        Matt (MPCM)
      • keelypavan
        Ashwin, ... You directly have Javascript statement for object and there was no need for eval ing it. That was Doug s point. Pavan Keely
        Message 3 of 11 , Jun 15, 2006
        • 0 Attachment
          Ashwin,

          This confusion came up because in the sample code you provided:

          > myJSONtext = {user: {errorFirstName:"", errorLastName:"",
          > errorEmail:"The email address you entered is not valid." } };

          You directly have Javascript statement for object and there was no
          need for 'eval'ing it. That was Doug's point.

          Pavan Keely

          --- In json@yahoogroups.com, "Matthew Morley" <WickedLogic@...> wrote:
          >
          > Perhaps he is asking why you aren't using:
          >
          > http://json.org/json.js
          > -----------------------------------------------------
          > string.parseJSON()
          >
          > This method parses a JSON text to produce an object or
          > array. It will return false if there is an error.
          > --
          > Matt (MPCM)
          >
        • Todd Kingham
          Ashwin, It sounds like either your eval() statement is incorrect or your JSON string is malformatted. Below is a simple example of some JSON written in
          Message 4 of 11 , Jun 15, 2006
          • 0 Attachment
            Ashwin,

            It sounds like either your eval() statement is incorrect or your JSON string
            is malformatted.

            Below is a simple example of some JSON written in JavaScript that I know
            will work in Firefox.

            var JSONstr = '{keyOne:"Alpha",keyTwo:"Omega"}';
            var JSONvar = eval('('+JSONstr+')');
            alert(JSONvar.keyOne);

            This should work if you replace the JSONstr variable I'm setting here with a
            JSON string dynamically built on the server and passed in.

            HTH,
            -Todd



            On 6/15/06, Ashwin Prabhu <aprabhu1@...> wrote:
            >
            > Hi Doug,
            >
            > My understanding of JSON was that you need to form a Text in such way
            > that, when we create a JSON object using 'eval', then we can
            > traverse its properties using aJSONObject.attributeName.
            > So instead of returning XML and parsing it (which i have done before
            > in javascript ), i am returning this text and then converting it
            > into a JSON object.
            > Am i thinking wrong! Please correct me.
            >
            > Thanks.
            >
            > - Ashwin
            >
            > On Jun 13, 2006, at 9:02 PM, Douglas Crockford wrote:
            >
            > >> With quotes FireFox is throwing an error as 'invalidLabel', when the
            > >> 'eval' method is called.
            > >
            > > Why are you using eval?
            > >
            > >
            > >
            > >
            > >
            > > ------------------------ Yahoo! Groups Sponsor --------------------
            > > ~-->
            > > You can search right from your browser? It's easy and it's free.
            > > See how.
            > > http://us.click.yahoo.com/_7bhrC/NGxNAA/yQLSAA/1U_rlB/TM
            > > ----------------------------------------------------------
            > > ~->
            > >
            > >
            > > Yahoo! Groups Links
            > >
            > >
            > >
            > >
            > >
            > >
            > >
            >
            >
            >


            [Non-text portions of this message have been removed]
          • Ashwin Prabhu
            Hey Guys, Thanks very much for all the clarifications. i think, i know what i was doing wrong. As for parseJSON, yup i will using that. Thanks again! -
            Message 5 of 11 , Jun 16, 2006
            • 0 Attachment
              Hey Guys,

              Thanks very much for all the clarifications. i think, i know what i
              was doing wrong.
              As for parseJSON, yup i will using that.

              Thanks again!

              - Ashwin

              On Jun 15, 2006, at 12:08 PM, keelypavan wrote:

              > Ashwin,
              >
              > This confusion came up because in the sample code you provided:
              >
              >> myJSONtext = {user: {errorFirstName:"", errorLastName:"",
              >> errorEmail:"The email address you entered is not valid." } };
              >
              > You directly have Javascript statement for object and there was no
              > need for 'eval'ing it. That was Doug's point.
              >
              > Pavan Keely
              >
              > --- In json@yahoogroups.com, "Matthew Morley" <WickedLogic@...> wrote:
              >>
              >> Perhaps he is asking why you aren't using:
              >>
              >> http://json.org/json.js
              >> -----------------------------------------------------
              >> string.parseJSON()
              >>
              >> This method parses a JSON text to produce an object or
              >> array. It will return false if there is an error.
              >> --
              >> Matt (MPCM)
              >>
              >
              >
              >
              >
              >
              >
              >
              > ------------------------ Yahoo! Groups Sponsor --------------------
              > ~-->
              > Great things are happening at Yahoo! Groups. See the new email
              > design.
              > http://us.click.yahoo.com/TISQkA/hOaOAA/yQLSAA/1U_rlB/TM
              > --------------------------------------------------------------------
              > ~->
              >
              >
              > Yahoo! Groups Links
              >
              >
              >
              >
              >
              >
            Your message has been successfully submitted and would be delivered to recipients shortly.