comparison samples/json.tp @ 154:6e579a75a0a9

Add JSON parser and sample
author Mike Pavone <pavone@retrodev.com>
date Sat, 10 Aug 2013 11:51:47 -0700
parents
children
comparison
equal deleted inserted replaced
153:075b1e71feff 154:6e579a75a0a9
1 #{
2 main <- {
3 arr <- json decode: "[\"foo\", \"bar\", 13245, \"baz\" ]"
4 foreach: arr :idx val {
5 print: (string: idx) . ": " . (string: val) . "\n"
6 }
7 obj <- json decode: "{\"foo\": \"bar\", \"baz\": \"qux\", \"meaningOfLife\": 42 }"
8 foreach: obj :idx val {
9 print: (string: idx) . ": " . (string: val) . "\n"
10 }
11 }
12 }