File: tests.txt

package info (click to toggle)
dasel 2.8.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,844 kB
  • sloc: sh: 53; python: 21; makefile: 21; xml: 20
file content (72 lines) | stat: -rw-r--r-- 2,335 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
START
Root Object
root_object
daselv2 -f benchmark/data.json
dasel -f benchmark/data.json
jq '.' benchmark/data.json
yq --yaml-output '.' benchmark/data.yaml
END
START
Top level property
top_level_property
daselv2 -f benchmark/data.json 'id'
dasel -f benchmark/data.json '.id'
jq '.id' benchmark/data.json
yq --yaml-output '.id' benchmark/data.yaml
END
START
Nested property
nested_property
daselv2 -f benchmark/data.json 'user.name.first'
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
daselv2 -f benchmark/data.json 'favouriteNumbers.[1]'
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
daselv2 put -f benchmark/data.json -t string -v 'blue' -o - 'favouriteColours.[]'
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
daselv2 put -f benchmark/data.json -t string -v 'blue' -o - 'favouriteColours.[0]'
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
daselv2 put -f benchmark/data.json -o - -t json -v '{"first":"Frank","last":"Jones"}' 'user.name'
dasel put document -f benchmark/data.json -o - -d json '.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
daselv2 -f benchmark/data.json 'all().key()'
dasel -f benchmark/data.json -m '.-'
jq 'keys[]' benchmark/data.json
yq --yaml-output 'keys[]' benchmark/data.yaml
END
START
Delete property
delete_property
daselv2 delete -f benchmark/data.json -o - 'id'
dasel delete -f benchmark/data.json -o - '.id'
jq 'del(.id)' benchmark/data.json
yq --yaml-output 'del(.id)' benchmark/data.yaml
END