Beginning of JSON generation support

Currently it's mostly stubbed out.