Created
March 14, 2022 19:20
-
-
Save pmbrull/ff1cd3a3a53c7d2cb60fae716bc0529f to your computer and use it in GitHub Desktop.
How to make the most of Pydantic 02
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
my_json = { | |
"name": "Lévy", | |
"age": 3, | |
"address": { | |
"city": "Wonderland", | |
"zip_code": "ABCDE", | |
"number": 123 | |
} | |
} | |
data = CatRequest.parse_obj(my_json) | |
data.name # Lévy | |
data.address.number # 123 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment