dimanche 5 août 2018

How to check the value in json using the if statement?

I have a json below

"root":[
  {
    "refDataId": 1,
    "children": [
      {
        "refDataId": 20
      },
      {
        "refDataId": 99,
        "otherValue": "Facility"
      }
    ]
  },
  {
    "refDataId": 2,
    "children": [
      {
        "refDataId": 30
      },
      {
        "refDataId": 99,
        "otherValue": "Officer"
      }
    ]
  }
]

How to check the value above using the if statement?

And how to check the value of "refDataId": 99, and "otherValue": "Officer"?

If the value has to get from 2nd child json "refDataId": 2,

Aucun commentaire:

Enregistrer un commentaire