Cleanup and tests for json parsing.