Move JSON compatibility right along couchdb storage

Since JSON serialization is specific to CouchDB backend, I moved it there.

If you don't agree, please argue :)