Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,31 @@
|
|||
def mydict: {"hello":13, "world": 31, "!": 71};
|
||||
|
||||
# Iterating over the keys
|
||||
mydict | keys[]
|
||||
# "!"
|
||||
# "hello"
|
||||
# "world"
|
||||
|
||||
# Iterating over the values:
|
||||
mydict[]
|
||||
# 13
|
||||
# 31
|
||||
# 71
|
||||
|
||||
# Generating a stream of {"key": key, "value": value} objects:
|
||||
mydict | to_entries[]
|
||||
# {"key":"hello","value":13}
|
||||
# {"key":"world","value":31}
|
||||
# {"key":"!","value":71}
|
||||
|
||||
# Generating a stream of [key,value] arrays:
|
||||
mydict | . as $o | keys[] | [., $o[.]]
|
||||
#["!",71]
|
||||
#["hello",13]
|
||||
#["world",31]
|
||||
|
||||
# Generating a stream of [key,value] arrays, without sorting (jq > 1.4 required)
|
||||
mydict | . as $o | keys_unsorted[] | [., $o[.]]
|
||||
# ["hello",13]
|
||||
# ["world",31]
|
||||
# ["!",71]
|
||||
Loading…
Add table
Add a link
Reference in a new issue