The following command selects only objects, which contain a key named "result"
.
cat input.json | jq '. | select(.result != null)' > output.json
The following command will keep only the "text"
attribute of every object on the top layer of the input data.
jq '. | {text}' input.json > output.json
attr1
in the resulting object unconditionallynew_attr
new_attr
attribute value will be an arraynew_attr
will contains a selection of array elements of attr2
some_key
, whose value is < 1
jq '. | {attr1, new_attr: [.attr2 | .[] | select(.some_key < 1)] }' input.json > output.json
Usage:
{ cat <
:results: { "text": "在 这里", "result": [ { "conf": 0.9, "end": 17.13, "start": 16.95, "word": "在" } ] } :end: