Skip to search.

Breaking News Visit Yahoo! News for the latest.

×Close this window

json · JSON JavaScript Object Notation

The Yahoo! Groups Product Blog

Check it out!

Group Information

  • Members: 593
  • Category: Data Formats
  • Founded: Jul 19, 2005
  • Language: English
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Real people. Real stories. See how Yahoo! Groups impacts members worldwide.

Messages

Advanced
Messages Help
JSON text not parsing on FireFox   Topic List   < Prev Topic  |  Next Topic >
Summarize Messages Sort by Date  
#407 From: Ashwin Prabhu <aprabhu1@...>
Date: Mon Jun 12, 2006 10:39 pm
Subject: JSON text not parsing on FireFox
ashp_says_hi
Send Email Send Email
 
Hi,

My JSON text looks as below:

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

But when i try to fetch the values it gives an error as
invalidLabel.. not sure why this is happening?
Value is fetched as myJSONtext.user.errorFirstName.

Also i tried creating an array as in the example on http://
www.json.org/js.html

But still it gives myJSONtext.user has no properties.

Any hint what am i doing wrong.

- Ashwin




#408 From: "Martin Cooper" <mfncooper@...>
Date: Mon Jun 12, 2006 11:40 pm
Subject: Re: JSON text not parsing on FireFox
mfncooper
Send Email Send Email
 
On 6/12/06, Ashwin Prabhu <aprabhu1@...> wrote:
>
> Hi,
>
> My JSON text looks as below:
>
> myJSONtext = {user: {errorFirstName:"", errorLastName:"",
> errorEmail:"The email address you entered is not valid." } };
>
> But when i try to fetch the values it gives an error as
> invalidLabel.. not sure why this is happening?


It works fine for me in Firebug. You didn't provide any surrounding code,
but are you sure myJSONtext is still in scope when you're trying to access
it?

--
Martin Cooper


Value is fetched as myJSONtext.user.errorFirstName.
>
> Also i tried creating an array as in the example on http://
> www.json.org/js.html
>
> But still it gives myJSONtext.user has no properties.
>
> Any hint what am i doing wrong.
>
> - Ashwin
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>


[Non-text portions of this message have been removed]




#409 From: henrik hjelte <henrik@...>
Date: Tue Jun 13, 2006 4:31 pm
Subject: Re: JSON text not parsing on FireFox
jagarenbrape...
Send Email Send Email
 
This is javascript code, not JSON. Keys should have surrounding quotes
in JSON.

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

/Henrik Hjelte

On mån, 2006-06-12 at 22:39 +0000, Ashwin Prabhu wrote:
> Hi,
>
> My JSON text looks as below:
>
> myJSONtext = {user: {errorFirstName:"", errorLastName:"",
> errorEmail:"The email address you entered is not valid." } };
>
> But when i try to fetch the values it gives an error as
> invalidLabel.. not sure why this is happening?
> Value is fetched as myJSONtext.user.errorFirstName.
>
> Also i tried creating an array as in the example on http://
> www.json.org/js.html
>
> But still it gives myJSONtext.user has no properties.
>
> Any hint what am i doing wrong.
>
> - Ashwin
>
>
>
>
>




#410 From: Ashwin Prabhu <aprabhu1@...>
Date: Tue Jun 13, 2006 6:53 pm
Subject: Re: JSON text not parsing on FireFox
ashp_says_hi
Send Email Send Email
 
Hi Henrik and Martin,

Thanks very much for your response.
Without quotes its working for me.
With quotes FireFox is throwing an error as 'invalidLabel', when the
'eval' method is called.

Things are working now :)

- Ashwin


On Jun 13, 2006, at 9:31 AM, henrik hjelte wrote:

> This is javascript code, not JSON. Keys should have surrounding quotes
> in JSON.
>
> {"user": {"errorFirstName":"", "errorLastName::"", "errorEmail":"The
> email address you entered is not valid." } }
>
> /Henrik Hjelte
>
> On mån, 2006-06-12 at 22:39 +0000, Ashwin Prabhu wrote:
>> Hi,
>>
>> My JSON text looks as below:
>>
>> myJSONtext = {user: {errorFirstName:"", errorLastName:"",
>> errorEmail:"The email address you entered is not valid." } };
>>
>> But when i try to fetch the values it gives an error as
>> invalidLabel.. not sure why this is happening?
>> Value is fetched as myJSONtext.user.errorFirstName.
>>
>> Also i tried creating an array as in the example on http://
>> www.json.org/js.html
>>
>> But still it gives myJSONtext.user has no properties.
>>
>> Any hint what am i doing wrong.
>>
>> - Ashwin
>>
>>
>>
>>
>>
>
>
>
> ------------------------ Yahoo! Groups Sponsor --------------------
> ~-->
> Home is just a click away. Make Yahoo! your home page now.
> http://us.click.yahoo.com/DHchtC/3FxNAA/yQLSAA/1U_rlB/TM
> --------------------------------------------------------------------
> ~->
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>




#411 From: "Douglas Crockford" <douglas@...>
Date: Wed Jun 14, 2006 4:02 am
Subject: Re: JSON text not parsing on FireFox
douglascrock...
Send Email Send Email
 
> With quotes FireFox is throwing an error as 'invalidLabel', when the
> 'eval' method is called.

Why are you using eval?






#412 From: Ashwin Prabhu <aprabhu1@...>
Date: Thu Jun 15, 2006 6:40 pm
Subject: Re: Re: JSON text not parsing on FireFox
ashp_says_hi
Send Email Send Email
 
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
>
>
>
>
>
>
>




#413 From: "Matthew Morley" <WickedLogic@...>
Date: Thu Jun 15, 2006 7:05 pm
Subject: Re: Re: JSON text not parsing on FireFox
mpcmtechnolo...
Send Email Send Email
 
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)



#416 From: "keelypavan" <keelypavan@...>
Date: Thu Jun 15, 2006 7:08 pm
Subject: Re: JSON text not parsing on FireFox
keelypavan
Send Email Send Email
 
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)
>








#417 From: Ashwin Prabhu <aprabhu1@...>
Date: Fri Jun 16, 2006 3:55 pm
Subject: Re: Re: JSON text not parsing on FireFox
ashp_says_hi
Send Email Send Email
 
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
>
>
>
>
>
>




#414 From: Michal Migurski <mike-jsonphp@...>
Date: Thu Jun 15, 2006 7:00 pm
Subject: Re: Re: JSON text not parsing on FireFox
michal_migurski
Send Email Send Email
 
> 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




#415 From: "Todd Kingham" <toddkingham@...>
Date: Thu Jun 15, 2006 7:14 pm
Subject: Re: Re: JSON text not parsing on FireFox
toddkingham
Send Email Send Email
 
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]




 
Add to My Yahoo!      XML What's This?

Copyright © 2010 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines NEW - Help