JSON is a language independent text format for data-interchange. JSON is especially convenient in web applications, since it is a subset of the literal object notation of ECMAScript. It can also be an alternative to XML. JSON has good open-source support in many languages.
eval('(' + aJSONtext + ')')
Even a seasoned lisper may find it difficult to make a shorter JavaScript parser for s-expressions.You can use any of these functions:
decode-json
decode-json-strict
decode-json-from-string
encode-json
encode-json-to-string
json-bind, use like this:
(test test-json-bind
(json-bind (hello hi ciao) "{\"hello\":100,\"hi\":5}"
(is (= hello 100))
(is (= hi 5))
(is-false ciao)))
Json-rpc, implements the json-rpc specification. Easily add it to your favourite webserver.
defun-json-rpc
export-as-json-rpc
clear-exported
invoke-rpc
Tweaking
*json-symbols-package* Default keyword, set to a package or nil for current package.
*json-object-factory* Change how objects are decoded to Lisp.
*use-strict-json-rules*
For examples, see the FiveAM based testcases.
A Darcs repository is available.
darcs get http://common-lisp.net/project/cl-json/darcs/cl-json
The latest release can be downloaded here.
You can also install it by asdf-install.
History has shown that the darcs version is probably better than the latest release.
MIT-license