Move json generation to new visitor

And get rid of a bunch of dead code!