2021-08-15 15:07:16 +03:00
|
|
|
$ fq -i -n '"[]" | json'
|
|
|
|
json> (.) | ., tovalue, type, length?
|
2021-09-16 23:40:03 +03:00
|
|
|
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|
|
2021-12-08 18:20:37 +03:00
|
|
|
0x0|5b 5d| |[]| |.: [0:0] (json)
|
2021-08-15 15:07:16 +03:00
|
|
|
[]
|
|
|
|
"array"
|
|
|
|
0
|
|
|
|
json> (.)[0] | ., type, length?
|
|
|
|
null
|
|
|
|
"null"
|
|
|
|
0
|
|
|
|
json> (.)[-1000] | ., type, length?
|
|
|
|
null
|
|
|
|
"null"
|
|
|
|
0
|
|
|
|
json> (.)[1000] | ., type, length?
|
|
|
|
null
|
|
|
|
"null"
|
|
|
|
0
|
|
|
|
json> (.)[1:3] | ., type, length?
|
|
|
|
[]
|
|
|
|
"array"
|
|
|
|
0
|
|
|
|
json> (.)[0:-1] | ., type, length?
|
|
|
|
[]
|
|
|
|
"array"
|
|
|
|
0
|
|
|
|
json> (.)[-1000:2000] | ., type, length?
|
|
|
|
[]
|
|
|
|
"array"
|
|
|
|
0
|
|
|
|
json> (.)["test"] | ., type, length?
|
|
|
|
error: expected an object but got: array
|
|
|
|
json> [(.)[]] | type, length?
|
|
|
|
"array"
|
|
|
|
0
|
|
|
|
json> (.) | keys
|
|
|
|
[]
|
|
|
|
json> (.) | has("a")
|
|
|
|
error: cannot check whether array has a key: a
|
|
|
|
json> (.) | has(0)
|
|
|
|
false
|
|
|
|
json> (.) | type
|
|
|
|
"array"
|
|
|
|
json> (.) | tonumber
|
|
|
|
error: tonumber cannot be applied to: array
|
|
|
|
json> (.) | tostring
|
|
|
|
error: tostring cannot be applied to: array
|
|
|
|
json> (.) + ""
|
|
|
|
error: cannot add: array ([]) and string ("")
|
|
|
|
json> (.) + 1
|
|
|
|
error: cannot add: array ([]) and number (1)
|
|
|
|
json> (.)._start | ., type, length?
|
|
|
|
0
|
|
|
|
"number"
|
|
|
|
0
|
|
|
|
json> (.)._stop | ., type, length?
|
|
|
|
16
|
|
|
|
"number"
|
|
|
|
16
|
|
|
|
json> (.)._len | ., type, length?
|
|
|
|
16
|
|
|
|
"number"
|
|
|
|
16
|
|
|
|
json> (.)._name | ., type, length?
|
|
|
|
""
|
|
|
|
"string"
|
|
|
|
0
|
2021-11-03 19:19:33 +03:00
|
|
|
json> (.)._sym | ., type, length?
|
2021-11-05 19:24:49 +03:00
|
|
|
null
|
|
|
|
"null"
|
2021-08-15 15:07:16 +03:00
|
|
|
0
|
|
|
|
json> (.)._description | ., type, length?
|
2021-11-19 13:44:23 +03:00
|
|
|
null
|
|
|
|
"null"
|
2021-09-16 17:26:31 +03:00
|
|
|
0
|
2021-08-15 15:07:16 +03:00
|
|
|
json> (.)._path | ., type, length?
|
|
|
|
[]
|
|
|
|
"array"
|
|
|
|
0
|
|
|
|
json> (.)._bits | ., type, length?
|
2022-05-20 13:38:43 +03:00
|
|
|
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|
|
2021-11-05 17:04:26 +03:00
|
|
|
0x0|5b 5d| |[]| |.: raw bits 0x0-0x1.7 (2)
|
2022-02-08 20:44:48 +03:00
|
|
|
"binary"
|
2021-08-15 15:07:16 +03:00
|
|
|
16
|
2021-09-27 23:42:34 +03:00
|
|
|
json>
|
2021-08-15 15:07:16 +03:00
|
|
|
json> (.)._bytes | ., type, length?
|
2022-05-20 13:38:43 +03:00
|
|
|
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|
|
2021-11-05 17:04:26 +03:00
|
|
|
0x0|5b 5d| |[]| |.: raw bits 0x0-0x1.7 (2)
|
2022-02-08 20:44:48 +03:00
|
|
|
"binary"
|
2021-08-15 15:07:16 +03:00
|
|
|
2
|
2021-09-27 23:42:34 +03:00
|
|
|
json>
|
2021-08-15 15:07:16 +03:00
|
|
|
json> (.)._error | ., type, length?
|
|
|
|
null
|
|
|
|
"null"
|
|
|
|
0
|
|
|
|
json> (.)._unknown | ., type, length?
|
|
|
|
false
|
|
|
|
"boolean"
|
|
|
|
json> (.).a = 1
|
|
|
|
error: expected an object but got: array
|
|
|
|
json> (.)[0] = 1
|
|
|
|
[
|
|
|
|
1
|
|
|
|
]
|
|
|
|
json> (.).a |= empty
|
|
|
|
error: expected an object but got: array
|
|
|
|
json> (.)[0] |= empty
|
|
|
|
[]
|
|
|
|
json> (.) | setpath(["a"]; 1)
|
2022-04-10 12:51:14 +03:00
|
|
|
error: expected an object but got: array ([])
|
2021-08-15 15:07:16 +03:00
|
|
|
json> (.) | setpath([0]; 1)
|
|
|
|
[
|
|
|
|
1
|
|
|
|
]
|
|
|
|
json> (.) | delpaths([["a"]])
|
2022-04-10 12:51:14 +03:00
|
|
|
error: expected an object but got: array ([])
|
2021-08-15 15:07:16 +03:00
|
|
|
json> (.) | delpaths([[0]])
|
|
|
|
[]
|
|
|
|
json> ^D
|