Is it possible to access a json array element without using index number?

Viewed 2223

I have the following JSON:

{
   "responseObject": {
   "name": "ObjectName",
   "fields": [
   {
     "fieldName": "refId",
     "value": "2170gga35511"
   },
   {
     "fieldName": "telNum",
     "value": "4541885881"
   }]}
}

I want to access "value" of the the array element with "fieldName": "telNum" without using index numbers, because I don't know everytime exactly at which place this telNum element will appear.

What I dream of is something like this:

jsonVarName.responseObject.fields['fieldname'='telNum'].value

Is this even possible in JavaScript?

6 Answers
Related