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.