-
Given the following JSON document:
How can I get a list of all arrays? In this case I am only interested in getting this as a result:
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
You can use the index/property selector to return the keys of an object: https://dasel.tomwright.me/s/931c278a-a1e8-45f0-bc68-675daf6ebd46
|
Beta Was this translation helpful? Give feedback.
-
Hy @paradajz , With dasel v2 (still in development but you are welcome to start using it) you can do this with the following: echo '{
"array1": [
{
"a": "aaa",
"b": "bbb",
"c": "ccc"
}
],
"array2": [
{
"a": "aaa",
"b": "bbb",
"c": "ccc"
}
]
}' | dasel -r json -w - 'all().filter(equal(type(),array)).key()'
array1
array2 V2 docs are here: https://daseldocs.tomwright.me/v/v2/ |
Beta Was this translation helpful? Give feedback.
You can use the index/property selector to return the keys of an object: https://dasel.tomwright.me/s/931c278a-a1e8-45f0-bc68-675daf6ebd46
dasel -f in.json -m '.-'