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

882Accessing a JSON element name (metadata)

Expand Messages
  • mahesh_mission
    Oct 10, 2007
    • 0 Attachment
      Hi,

      I have a JSON object whose structure is like this:

      The name of the object is 'Emp' and the attributes are:
      name
      age
      sex
      department
      address

      Later in my javascript code, I have to check if the JSON object's
      value matches with my local value. For this I have to check

      if (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.
    • Show all 2 messages in this topic