Trying to create a document with db.create_doc and using a valid json string as the content produces an "InvalidJSON" error:
>>> import u1db
>>> db = u1db.open(":memory:", create=True)
>>> db.create_doc("{}")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/lucio/canonical/dedit/trunk/u1db-env/local/lib/python2.7/site-packages/u1db/backends/__init__.py", line 94, in create_doc
doc = self._factory(doc_id, None, json_string)
File "/home/lucio/canonical/dedit/trunk/u1db-env/local/lib/python2.7/site-packages/u1db/__init__.py", line 527, in __init__
super(Document, self).__init__(doc_id, rev, json, has_conflicts)
File "/home/lucio/canonical/dedit/trunk/u1db-env/local/lib/python2.7/site-packages/u1db/__init__.py", line 423, in __init__
raise InvalidJSON
u1db.errors.InvalidJSON
Looking at the code, i see that backends/__init__.py:CommonBackend.create_doc forces the conversion to json and does not check if the input content is a dict.