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: 591
  • Category: Data Formats
  • Founded: Jul 19, 2005
  • Language: English
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Hear how Yahoo! Groups has changed the lives of others. Take me there.

Messages

Advanced
Messages Help
eval() throwing error in IE   Topic List   < Prev Topic  |  Next Topic >
Summarize Messages Sort by Date  
#868 From: "mahesh_mission" <mahesh_mission@...>
Date: Wed Sep 26, 2007 2:19 pm
Subject: eval() throwing error in IE
mahesh_mission
Send Email Send Email
 
Hi,

I have a JSON object which has a strcture like this :

{ "MainData":
{

"Company":
{
"Name":"ABC Ltd",
"Address":"<address>"
},
"Data":
{
"001":
{
"Name": "Test",
"Age":"45"
},
"002":
{
"Name" : "Sample",
"Age":"35"
}
}
}
}

In this, "001", "002" are emloyee numbers.
Now assume the employee number is passed from an another function as
an input. (Let it be EmpNo)

Now, I need to check if the passed in employee number is present in
the JSON structure and accordingly retreive the data.

I need to use the javascript for this.
If I try to say

MainData.Company.Data.eval(EmpNo);

This works fine in mozilla.

But if I run the same program in IE, I get an error message "object
doesn't support this property or method".

I found that the eval() in this case doesn't work in IE. Could you
please suggest a solution.

Thanks a lot.




#869 From: "Douglas Crockford" <douglas@...>
Date: Thu Sep 27, 2007 1:36 pm
Subject: Re: eval() throwing error in IE
douglascrock...
Send Email Send Email
 
--- In json@yahoogroups.com, "mahesh_mission" <mahesh_mission@...> wrote:

> If I try to say
>
> MainData.Company.Data.eval(EmpNo);
>
> This works fine in mozilla.
>
> But if I run the same program in IE, I get an error message "object
> doesn't support this property or method".

That form of eval is not in the ECMAScript standard. I recommend that
you stick with the standard language.




#870 From: "kriszyp" <kriszyp@...>
Date: Thu Sep 27, 2007 4:39 pm
Subject: Re: eval() throwing error in IE
kriszyp
Send Email Send Email
 
I think you want:
MainData.Company.Data[EmpNo]





 
Add to My Yahoo!      XML What's This?

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