Created
July 31, 2020 01:15
-
-
Save cadu-leite/faca1fab617ad2a93afaa46353355a4f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# "convert"or transform a Json to objet attributes | |
# converte ou transforma um Json em objeto com atributos | |
def _json_object_hook(d:Dict): | |
return namedtuple('X', d.keys(), rename=True)(*d.values()) | |
def json2obj(data_json: str): | |
return json.loads(data_json, object_hook=_json_object_hook) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment