Added some utilities for JSON reading/writing.
Changed the protocol to use JSON.
Changed server to use JSON for communication.
Added missed changes from last commit.