Fixes json serialization for u1db.Document instances. some code cleanup.

Added json serialization of strings for creating Document instances.

Added doc string.