Extract a single field from JSON with jq
get value from json command line | jq raw output into shell variable | query nested json field jq | jq | json | extractjq -r '.require.php' composer.jsonPrints the value at the given path. Nested fields are joined with dots, array elements are accessed with .[0]. The -r option returns strings without quotes, so the result can be used directly in scripts. If the field does not exist, jq prints null.
Note: The filter '.require | keys[]' lists all keys of an object.
Also searched as
- get value from json command line
- jq raw output into shell variable
- query nested json field jq