Recursive search values by key

后端 未结 2 557
长发绾君心
长发绾君心 2020-12-10 05:17

I have a JSON like this:

{ 
  \"A\": { \"error\": null },
  \"B\": { \"C\": {\"error\": \"error string\"}},
  \"C\": { \"D\": {\"error\": null}},
  \"D\": {          


        
2条回答
  •  既然无缘
    2020-12-10 06:03

    Here is a solution that uses tostream and select

      tostream
    | select(length==2 and .[0][-1]=="error" and .[1]!=null) as [$p,$v]
    | $v
    

提交回复
热议问题