- json_tokenize("[8, \"abc\", 9]", tokens)
- json_parse_value(tokens, 0, array, 0)
- print json_write_value(array[0])
-
- json_tokenize("{\"abc\": 1, \"def\": 2}", tokens)
- json_parse_value(tokens, 0, array, 0)
- print json_write_value(array[0])
-
- json = "{ \"first\": { \"arr\": [ \"\", " \
- " -1, " \
- " 1.2, " \
- " true, " \
- " false, " \
- " null ], " \
- " \"number\": 42, " \
- " \"obj\": { \"A\": \"a!\", " \
- " \"B\": \"b!\", " \
- " \"C\": \"c!\" }, " \
- " \"str\": \"hello, world\" }, " \
- " \"second\": { \"arr\": [ \"zero\", " \
- " \"one\", " \
- " \"two\" ], " \
- " \"number\": 42, " \
- " \"obj\": { \"A\": \"a!\", " \
- " \"B\": \"b!\", " \
- " \"C\": \"c!\" }, " \
- " \"str\": \"hello, world\" } }"
-
- json_tokenize(json, tokens)
- json_parse_value(tokens, 0, array, 0)
- print json_write_value(array[0])
+ print "Testing JSON Read:"
+
+ json_decode("[8, \"abc\", 9]", array);
+ print json_encode(array)
+
+ json_decode("{\"abc\": 1, \"def\": 2}", array)
+ print json_encode(array)
+
+ json = "{ \"first\": { \"arr\": [ \"\", \n" \
+ " -1, \n" \
+ " 1.2, \n" \
+ " true, \n" \
+ " false, \n" \
+ " null ], \n" \
+ " \"number\": 42, \n" \
+ " \"eobj\": [ ], \n" \
+ " \"earr\": { }, \n" \
+ " \"obj\": { \"A\": \"a!\", \n" \
+ " \"B\": \"b!\", \n" \
+ " \"C\": \"c!\" }, \n" \
+ " \"str\": \"hello, world\" }, \n" \
+ " \"second\": { \"arr\": [ \"zero\", \n" \
+ " \"one\", \n" \
+ " \"two\", \n" \
+ " \"\\\"\t\r\b\" ], \n" \
+ " \"number\": 42, \n" \
+ " \"obj\": { \"A\": \"a!\", \n" \
+ " \"B\": \"b!\", \n" \
+ " \"C\": \"c!\" }, \n" \
+ " \"str\": \"hello, world\" } }\n"
+
+ json_decode(json, array)
+ print json_encode(array)