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

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

Expand Messages
  • Todd Kingham
    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]
    • Show all 11 messages in this topic