forked from Jiangtang/Programming-SAS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
groovy_map.sas
81 lines (54 loc) · 1.55 KB
/
groovy_map.sas
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
/*https://github.com/seven1m/openwar/wiki/Map.json*/
proc groovy;
submit;
import groovy.json.JsonSlurper
def map = new JsonSlurper().parseText(new File('c:\\users\\jhu\\map.json').text)
println map
endsubmit;
quit;
proc groovy;
submit;
import groovy.json.JsonSlurper
def map = new JsonSlurper().parseText(new File('c:\\users\\jhu\\map.json').text)
map.each {println it}
endsubmit;
quit;
proc groovy;
submit;
import groovy.json.JsonSlurper
import groovy.json.JsonBuilder
def map = new JsonSlurper().parseText(new File('c:\\users\\jhu\\map.json').text)
def tree
tree = { -> return [:].withDefault{ tree() } }
map = tree()
println new groovy.json.JsonBuilder( map ).toPrettyString()
endsubmit;
quit;
proc groovy;
submit;
import groovy.json.JsonSlurper
def result = new JsonSlurper().parseText(new File('a:\\test\\person.json').text)
exports.putAt('bonusRegions',result['bonusRegions.southeast'])
exports.putAt('regions' ,result['regions'])
endsubmit;
quit;
%put &bonusRegions;
%put ®ions;
proc groovy;
submit;
import groovy.json.JsonSlurper
def result = new JsonSlurper().parseText(new File('a:\\test\\person.json').text)
println result.address.streetAddress
println ""
println "Street Address: $result.address.streetAddress"
println ""
println result.address["streetAddress"]
endsubmit;
quit;
proc groovy;
submit;
import groovy.json.JsonSlurper
def result = new JsonSlurper().parseText(new File('a:\\test\\person.json').text)
println result.address.size()
endsubmit;
quit;