JSON checker

Started by kosh, June 28, 2013, 06:03:02 AM

Previous topic - Next topic

kosh

This test code is based on JSON Checker (http://www.json.org/JSON_checker/">http://www.json.org/JSON_checker/)



json-test.lsp: http://pastebin.com/9nqJHSW3">http://pastebin.com/9nqJHSW3



The results are here:


> newlisp -v
newLISP v.10.5.2 32-bit on Win32 IPv4/6 UTF-8 libffi.

> newlisp json-test.lsp
fail1.json -> pass : "A JSON payload should be an object or array, not a string."
fail7.json -> pass : ["Comma after the close"],
fail8.json -> pass : ["Extra close"]]
fail10.json -> pass : {"Extra value after close": true} "misplaced quoted value"
fail13.json -> pass : {"Numbers cannot have leading zeroes": 013}
fail15.json -> pass : ["Illegal backslash escape: x15"]
fail17.json -> pass : ["Illegal backslash escape: 17"]
fail18.json -> pass : [[[[[[[[[[[[[[[[[[[["Too deep"]]]]]]]]]]]]]]]]]]]]
fail25.json -> pass : [" tab character in string "]
fail26.json -> pass : ["tab   character   in  string  "]
fail27.json -> pass : ["line
break"]
fail28.json -> pass : ["line
break"]


However, this is strictly data. I think current json-parse is enough to use.



PS. A strange things, fail18.json also passes on JSONLint (http://jsonlint.com/">http://jsonlint.com/).