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

RE: [json] Accessing a JSON element name (metadata)

Expand Messages
  • Mark Ireland
    Will this work? Emp[ localvar.name ] To: json@yahoogroups.comFrom: mahesh_mission@yahoo.comDate: Thu, 11 Oct 2007 05:19:55 +0000Subject: [json] Accessing a
    Message 1 of 2 , Oct 11, 2007
    • 0 Attachment
      Will this work?

      Emp["localvar.name"]


      To: json@yahoogroups.comFrom: mahesh_mission@...: Thu, 11 Oct 2007 05:19:55 +0000Subject: [json] Accessing a JSON element name (metadata)




      Hi,I have a JSON object whose structure is like this:The name of the object is 'Emp' and the attributes are:nameagesexdepartmentaddressLater in my javascript code, I have to check if the JSON object's value matches with my local value. For this I have to checkif (Emp.name == localvar.name) ...if (Emp.age == localvar.age) ...But the problem is I cannot know which of the attributes will come first for comparison, as no predefined order is allowed. So I have to first find out the current element of 'Emp' and accordingly compare the local variable with it.The problem is I cann't find the current element. Can someone pls tell me a way.Thanks.






      _________________________________________________________________
      It's simple! Sell your car for just $30 at CarPoint.com.au
      http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fsecure%2Dau%2Eimrworldwide%2Ecom%2Fcgi%2Dbin%2Fa%2Fci%5F450304%2Fet%5F2%2Fcg%5F801459%2Fpi%5F1004813%2Fai%5F859641&_t=762955845&_r=tig_OCT07&_m=EXT

      [Non-text portions of this message have been removed]
    Your message has been successfully submitted and would be delivered to recipients shortly.