{
"example": {
"sub-example": [
{
"name": "123-345",
"tag" : 100
},
{
"name": "234-456",
"tag" : 100
},
{
"name": "4a7-a07a5",
"tag" : 100
}
]
}
}
If you just want to extract the name fields, the command you're looking for is jq '.example."sub-example" | .[] | .name'. If you want to keep the names in an array, wrap the whole jq expression in square brackets.
to get length
jq '.example."sub-example" | length'
source: https://stackoverflow.com/a/39228718