Initial import

Inspired by the JSON writer classes in RAP, but completely rewritten
and complemented with a parser.