START
Root Object
root_object
dasel -f benchmark/data.json
jq '.' benchmark/data.json
yq --yaml-output '.' benchmark/data.yaml
END
START
Top level property
top_level_property
dasel -f benchmark/data.json '.id'
jq '.id' benchmark/data.json
yq --yaml-output '.id' benchmark/data.yaml
END
START
Nested property
nested_property
dasel -f benchmark/data.json '.user.name.first'
jq '.user.name.first' benchmark/data.json
yq --yaml-output '.user.name.first' benchmark/data.yaml
END
START
Array index
array_index
dasel -f benchmark/data.json '.favouriteNumbers.[1]'
jq '.favouriteNumbers[1]' benchmark/data.json
yq --yaml-output '.favouriteNumbers[1]' benchmark/data.yaml
END
START
Append to array of strings
append_array_of_strings
dasel put string -f benchmark/data.json -o - '.favouriteColours.[]' blue
jq '.favouriteColours += ["blue"]' benchmark/data.json
yq --yaml-output '.favouriteColours += ["blue"]' benchmark/data.yaml
END
START
Update a string value
update_string
dasel put string -f benchmark/data.json -o - '.favouriteColours.[0]' blue
jq '.favouriteColours[0] = "blue"' benchmark/data.json
yq --yaml-output '.favouriteColours[0] = "blue"' benchmark/data.yaml
END
START
Overwrite an object
overwrite_object
dasel put object -f benchmark/data.json -o - -t string -t string '.user.name' first=Frank last=Jones
jq '.user.name = {"first":"Frank","last":"Jones"}' benchmark/data.json
yq --yaml-output '.user.name = {"first":"Frank","last":"Jones"}' benchmark/data.yaml
END
START
List keys of an array
list_array_keys
dasel -f benchmark/data.json -m '.-'
jq 'keys[]' benchmark/data.json
yq --yaml-output 'keys[]' benchmark/data.yaml
END
START
Delete property
delete_property
dasel delete -f benchmark/data.json -o - '.id'
jq 'del(.id)' benchmark/data.json
yq --yaml-output 'del(.id)' benchmark/data.yaml
END
