File: json.pro

package info (click to toggle)
qtbase-opensource-src 5.3.2%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 272,016 kB
  • sloc: cpp: 1,623,095; ansic: 386,069; xml: 101,194; sh: 16,504; python: 9,156; java: 4,681; asm: 4,531; perl: 2,392; yacc: 1,926; lex: 970; makefile: 498; awk: 142; objc: 70; sed: 3
file content (26 lines) | stat: -rw-r--r-- 745 bytes parent folder | download | duplicates (3)
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
jsontext = $$cat($$PWD/test.json)
parseJson(jsontext, json)

# print all keys
message(json._KEYS_ $${json._KEYS_})

# print array
message(json.array._KEYS_ $${json.array._KEYS_})
for(key, json.array._KEYS_): \
    message(json.array.$${key} $$eval(json.array.$${key}))

# print object
message(json.object._KEYS_ $${json.object._KEYS_})
for(key, json.object._KEYS_): \
    message(json.object.$${key} $$eval(json.object.$${key}))

# print value tyes
message(json.string: $${json.string})
message(json.number: $${json.number})
message(json.true: $${json.true})
message(json.false: $${json.false})
message(json.null: $${json.null})

# check that booleans work
$${json.true}: message(json.true is true)
!$${json.false}: message(json.false is false)