JQ to Dasel
The follow examples show a set of jq commands and the equivalent in dasel.
Select a single value
echo '{"name": "Tom"}' | jq '.name'
"Tom"echo '{"name": "Tom"}' | dasel -p json '.name'
"Tom"Select a nested value
echo '{"user": {"name": "Tom", "age": 27}}' | jq '.user.age'
27echo '{"user": {"name": "Tom", "age": 27}}' | dasel -p json '.user.age'
27Select an array index
echo '[1, 2, 3]' | jq '.[1]'
2echo '[1, 2, 3]' | dasel -p json '.[1]'
2Append to an array of strings
echo '["a", "b", "c"]' | jq '. += ["d"]'
[
"a",
"b",
"c",
"d"
]echo '["a", "b", "c"]' | dasel put string -p json -s '.[]' d
[
"a",
"b",
"c",
"d"
]Update a string value
Update an int value
Overwrite an object
Append to an array of objects
Last updated