add create_doc convenience function: use cjson if available