json - Recursive search values by key -


i have json this:

{    "a": { "error": null },   "b": { "c": {"error": "error string"}},   "c": { "d": {"error": null}},   "d": { "error": "err str"} } 

end want find values of error keys not null.

for example should return

"error string" "err str" 

how can it? possible jq?

use .. iterate recursively, , .error values. if they're null, remove them:

jq '.. | .error? // empty' 

alternatively, instead of using empty can select elements strings strings:

jq '.. | .error? | strings' 

Comments

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -