Json – jq get value or default if nested key not present
I would like to make a small jq-like function that does get-or-default-if-not-present similar to Python's dict.get(key, default). This is the desired behavior: % echo '{"nested": {"key": "value", "tricky": null}}' > file.json % my-jq nested.key "default" file.json "value" % my-jq nested.tricky…