Implemented Session serialization.

* Refactored the Json encoders/decoders so they can be reused for general object
  serialization.

* Sessions can be serialized now and saved in a file. It is possible to load
  them from a file too. The cache is also preserved. This makes resuming from a
  session much faster.

BUG=
R=amoser@google.com, parki.san@gmail.com

Review URL: https://codereview.appspot.com/106010044