Json corruption patch

This should fix the problems with JSON being corrupted by the server.
A corresponding patch is on the client repo, so we'll have to apply that over there.

As mentioned in #1, this changes from singular JSON dictionaries and just printing them to sending a full JSON dictionary then printing parts of that in a loop.