File: value_json_array.fqtest

package info (click to toggle)
fq 0.9.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 106,624 kB
  • sloc: xml: 2,835; makefile: 250; sh: 241; exp: 57; ansic: 21
file content (125 lines) | stat: -rw-r--r-- 2,336 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
$ fq -i -n '"[]" | json'
json> (.) | ., tovalue, toactual, tosym, type, length?
[]
[]
[]
null
"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?
null
"null"
0
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
"[]"
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
json> (.)._actual | ., type, length?
[]
"array"
0
json> (.)._sym | ., type, length?
null
"null"
0
json> (.)._description | ., type, length?
null
"null"
0
json> (.)._path | ., type, length?
[]
"array"
0
json> (.)._bits | ., type, length?
   |00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|
0x0|5b 5d|                                         |[]|             |.: raw bits 0x0-0x2 (2)
"string"
16
json> (.)._bytes | ., type, length?
   |00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|
0x0|5b 5d|                                         |[]|             |.: raw bits 0x0-0x2 (2)
"string"
2
json> (.)._error | ., type, length?
null
"null"
0
json> (.)._gap | ., type, length?
false
"boolean"
json> (.).a = 1
error: setpath(["a"]; 1) cannot be applied to []: expected an object but got: array ([])
json> (.)[0] = 1
[
  1
]
json> (.).a |= empty
error: delpaths([["a"]]) cannot be applied to []: expected an object but got: array ([])
json> (.)[0] |= empty
[]
json> (.) | setpath(["a"]; 1)
error: setpath(["a"]; 1) cannot be applied to []: expected an object but got: array ([])
json> (.) | setpath([0]; 1)
[
  1
]
json> (.) | delpaths([["a"]])
error: delpaths([["a"]]) cannot be applied to []: expected an object but got: array ([])
json> (.) | delpaths([[0]])
[]
json> ^D