I want to clear all values from "dependencies" by using jq:
json_string="$(cat <<'END'{"name": "hello","dependencies": {"progress": "^2.0.0","tar": "^6.2.1" }}END)"Here is the expected output:
{"name": "hello","dependencies": {"progress": "","tar": "" }}I have tried but not work:
# output="$(jq ".dependencies =(.dependencies | keys)" <<< "$json_string")"# echo "output is: $output"output is: {"name": "hello","dependencies": ["progress","tar" ]}It only converts the object to an array, but I want it still as object and only clear all values inside all keys.
What's wrong in my jq command and how to fix?