Dude, just found this lib called `marshmallow`.
It’s a bit overkill for simple stuff, but if you’re dealing with complex json, it’s gold.
```python
from marshmallow import Schema, fields
class UserSchema(Schema):
name = fields.Str()
age = fields.Int()
data = UserSchema().load(json.loads('{"name": "Tom", "age": 25}'))
```
Now `data["name"]` works, but you can tweak it to use dots.
It’s a bit overkill for simple stuff, but if you’re dealing with complex json, it’s gold.
```python
from marshmallow import Schema, fields
class UserSchema(Schema):
name = fields.Str()
age = fields.Int()
data = UserSchema().load(json.loads('{"name": "Tom", "age": 25}'))
```
Now `data["name"]` works, but you can tweak it to use dots.
