Bluish Coder

Programming Languages, Martials Arts and Computers. The Weblog of Chris Double.


2006-08-07

JSON parser for Factor

I've implemented a simple JSON parser for Factor following RFC 4627. It will be available soon from the standard Factor repository and is also available from my darcs repository:

darcs get http://www.bluishcoder.co.nz/repos/factor

The three main words in the 'json' vocabulary are '>json', 'json-print' and 'json>'. An example of use is:

"json" require
USE: json
TUPLE: foo a b ;
"hi" "there" <foo> >json print
  => "{"a" : "hi", "b" : "there"}
"[ 10, 20, \"foo\", { \"value\" : 1e2 } ]" json> .
  => { 10 20 "foo" H{ { "value" 100 } } }

Factor tuples are converted to Javascript objects. Going the other way, Javascript objects are converted to Factor hashtables.

Tags


This site is accessable over tor as hidden service mh7mkfvezts5j6yu.onion, or Freenet using key:
USK@1ORdIvjL2H1bZblJcP8hu2LjjKtVB-rVzp8mLty~5N4,8hL85otZBbq0geDsSKkBK4sKESL2SrNVecFZz9NxGVQ,AQACAAE/bluishcoder/-44/


Tags

Archives
Links