For json to dict in function python, don’t forget to check if the input is *actually* a string.
Sometimes people pass bytes or other types.
```python
def json_to_dict(json_str):
if isinstance(json_str, bytes):
json_str = json_str.decode('utf-8')
return json.loads(json_str)
```
Saved me a few headaches!
Sometimes people pass bytes or other types.
```python
def json_to_dict(json_str):
if isinstance(json_str, bytes):
json_str = json_str.decode('utf-8')
return json.loads(json_str)
```
Saved me a few headaches!
