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

Comparing the metadata field with a variable passed

Expand Messages
  • mahesh_mission
    Hi, I have a JSON object which has a strcture like this : { MainData : { Company : { Name : ABC Ltd , Address : }, Data : { 001 : { Name :
    Message 1 of 1 , Aug 26, 2007

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

      { "MainData":

      "Name":"ABC Ltd",
      "Name": "Test",
      "Name" : "Sample",

      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


      this works fine if the EmpNo is 001 or 002.
      But if the EmpNo is 135, which is not present in the JSON output, it
      throws an error.

      How I can check that the input EmpNo is present in the JSON
      structure.(This needs to be done in javascript)
      Any help would be greatly appreciated.

      Thanks in advance for the answer.
    Your message has been successfully submitted and would be delivered to recipients shortly.