Implement Document.to_json_document() and test