1
2tst |empty array|
3in  |[]|
4sel |0|
5out |<NULL>|
6
7tst |one-element array: integer|
8in  |[1]|
9sel |0|
10out |1|
11sel |1|
12out |<NULL>|
13sel |100|
14out |<NULL>|
15sel |-1|
16out |<NULL>|
17
18tst |one-element array: hex integer (not in spec, not supported)|
19in  |[0x1000]|
20sel |0|
21out |<NULL>|
22
23tst |one-element array: float|
24in  |[1.5001]|
25sel |0|
26out |1.5001|
27
28tst |one-element array: float + exponent|
29in  |[16.3e10]|
30sel |0|
31out |16.3e10|
32
33tst |one-element array: integer + whitespace|
34in  |[ 	   5	]|
35sel |0|
36out |5|
37
38tst |one-element array: integer + exponent + whitespace|
39in  |[ 	    	 16E10  	 ]|
40sel |0|
41out |16E10|
42
43tst |one-element array: string|
44in  |["alpha"]|
45sel |0|
46out |alpha|
47
48tst |alternative first-element indexing|
49in  |[1,5,10,15,20]|
50sel |[0]|
51out |1|
52sel |[3]|
53out |15|
54sel |[4]|
55out |20|
56sel |[5]|
57out |<NULL>|
58
59tst |one-element array: object|
60in  |[ { "first": true, "second": false }]|
61sel |0.first|
62out |true|
63sel |0.second|
64out |false|
65sel |0.third|
66out |<NULL>|
67
68tst |many-element array: integers|
69in  |[0,1,1,2,3,5,8,13,21,34,55,89,144,233,377]|
70sel |10|
71out |55|
72sel |14|
73out |377|
74sel |19|
75out |<NULL>|
76
77tst |many-element array: multiple types|
78in  |["string",32,true,{"a":9,"b":false},100.3e10,false,200.5,{"key":"val"},null]|
79sel |0|
80out |string|
81sel |0.notobject|
82out |<NULL>|
83sel |1|
84out |32|
85sel |2|
86out |true|
87sel |3|
88out |{"a":9,"b":false}|
89sel |3.a|
90out |9|
91sel |3.b|
92out |false|
93sel |3.c|
94out |<NULL>|
95sel |4|
96out |100.3e10|
97sel |5|
98out |false|
99sel |6|
100out |200.5|
101sel |7|
102out |{"key":"val"}|
103sel |7.key|
104out |val|
105sel |7.key.notobject|
106out |<NULL>|
107sel |7.nonexist|
108out |<NULL>|
109sel |8|
110out |null|
111sel |9|
112out |<NULL>|
113
114tst |many-element array: multiple types + whitespace|
115in  |
116[	"string" ,	32 , true	,	 {"a":  9,	"b": false},		100.3e10, false, 200.5,{"key" 	:
117 "val"},		 null ]		|
118sel |0|
119out |string|
120sel |0.notobject|
121out |<NULL>|
122sel |1|
123out |32|
124sel |2|
125out |true|
126sel |3|
127out |{"a":  9,	"b": false}|
128sel |3.a|
129out |9|
130sel |3.b|
131out |false|
132sel |3.c|
133out |<NULL>|
134sel |4|
135out |100.3e10|
136sel |5|
137out |false|
138sel |6|
139out |200.5|
140sel |7|
141out |{"key" 	:
142 "val"}|
143sel |7.key|
144out |val|
145sel |7.key.notobject|
146out |<NULL>|
147sel |7.nonexist|
148out |<NULL>|
149sel |8|
150out |null|
151sel |9|
152out |<NULL>|
153
154tst |two-element array: various string escape codes|
155in  |["abcd \" \\ \/ \b \f \n \r \t \u0000 \uf00F ", "final"]|
156sel |0|
157out |abcd \" \\ \/ \b \f \n \r \t \u0000 \uf00F |
158sel |1|
159out |final|
160
161tst |three-element array: broken escape code|
162in  |["fine here", "dodgey \u00AZ", "wont get here"]|
163sel |0|
164out |fine here|
165sel |1|
166out |<NULL>|
167sel |2|
168out |<NULL>|
169
170tst |nested objects|
171in  |{ "top": { "mid"  : { "legs": "feet" }, "number": 9, "array":[0,1,{"a":true,"bb":[1,2,false,{"x":"yz"}]}]}}|
172sel |top|
173out |{ "mid"  : { "legs": "feet" }, "number": 9, "array":[0,1,{"a":true,"bb":[1,2,false,{"x":"yz"}]}]}|
174sel |fargo|
175out |<NULL>|
176sel |top.mid|
177out |{ "legs": "feet" }|
178sel |top.centre|
179out |<NULL>|
180sel |top.mid.legs|
181out |feet|
182sel |top.mid.number|
183out |<NULL>|
184sel |top.mid.array|
185out |<NULL>|
186sel |top.number|
187out |9|
188sel |top.array|
189out |[0,1,{"a":true,"bb":[1,2,false,{"x":"yz"}]}]|
190sel |top.array[0]|
191out |0|
192sel |top.array[1]|
193out |1|
194sel |top.array[2]|
195out |{"a":true,"bb":[1,2,false,{"x":"yz"}]}|
196sel |top.array[2].a|
197out |true|
198sel |top.array[2].b|
199out |<NULL>|
200sel |top.array[2].bb|
201out |[1,2,false,{"x":"yz"}]|
202sel |top.array[2].bb[0]|
203out |1|
204sel |top.array[2].bb[1]|
205out |2|
206sel |top.array[2].bb[2]|
207out |false|
208sel |top.array[2].bb[3]|
209out |{"x":"yz"}|
210sel |top.array[2].bb[3].x|
211out |yz|
212sel |top.array[2].bb[3].x.nofurther|
213out |<NULL>|
214sel |top.array[2].bb[4]|
215out |<NULL>|
216sel |top.array[3]|
217out |<NULL>|
218
219