Skip to content

Instantly share code, notes, and snippets.

@pmbrull
Created March 14, 2022 19:20
Show Gist options
  • Save pmbrull/ff1cd3a3a53c7d2cb60fae716bc0529f to your computer and use it in GitHub Desktop.
Save pmbrull/ff1cd3a3a53c7d2cb60fae716bc0529f to your computer and use it in GitHub Desktop.
How to make the most of Pydantic 02
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