I have a json file with structure like this:
{
"A": [{
"B": {
"C": [{
"D": {
"applicationNumberText": {
"value": "15570075",
"electronicText": "15570075"
},
"date": "2018-10-01",
"app": "Utility"
}
}]
}
}]
}
Now I want to retrieve electronicText value. One way is to use indexes like following
jq --stream 'select(.[0][1] == "A" and .[0][2] == "B" and .[0][3] == "C") | .[1]'
but the structure may differ in some cases so I want to refer by key values instead of indexes. I tried following method but it's not working
cat file.json | jq --stream 'select(.A|.[]. B. C|.[]. D.applicationNumberText)'
So I want to retrieve electronicText key without using indexes.
Note: I want to use stream option for large JSON file.