A few days ago I was reading Slava Pestov’s blog about his continuing development of his language “factor”. It’s always interesting, but the post that got me coding was his mention of JSON, the “java script object notation”. In particular, the pointer to a large and rambling Java implementation.
I reckoned I could do a smaller/simpler one, so I had a go. I used a strict test-first methodology and came up with a JSON reader in about 190 lines of Java and a JSON writer in about 150 lines of Java. Both assume correct syntax, so the third part is a validator, which I haven’t done yet.
My examples are not as concise as the Factor implementations, but they are a whole lot smaller than the jroller one, and they have absolutely no external dependecies.
Unfortunately I’m having trouble with access to sourceforge at the moment, but when I get it sorted out this code (and all the tests which drove it) will be added to the Stringtree project.
[Update] The validator is now written. See this more recent post for details
