More efficiency improvements for JSON client

The general principle here is that because the dicts json.loads gives us
are very close to the final format we want, we can just do a few
in-place modifications to these dicts rather than build entirely new
data structures.