def test_json_names(self):
        class Embedded(EmbeddedDocument):
            string = StringField(db_field='s')

        class Doc(Document):
            string = StringField(db_field='s')
            embedded = EmbeddedDocumentField(Embedded, db_field='e')

        doc = Doc( string="Hello", embedded=Embedded(string="Inner Hello"))
        doc_json = doc.to_json(sort_keys=True, use_db_field=False,separators=(',', ':'))

        expected_json = """{"embedded":{"string":"Inner Hello"},"string":"Hello"}"""

        self.assertEqual( doc_json, expected_json)
Going to test reported issue:
dataset/ETHPy150Open MongoEngine/mongoengine/tests/document/json_serialisation.py/TestJson.test_json_names