Best way to convert json to dict in function python? Need help! or How to properly handle json to dic

22 Replies, 1781 Views

If you're doing json to dict in function python, consider using the `simplejson` library. It’s more forgiving than the built-in `json` module.

Install it with `pip install simplejson` and use it the same way.

```python
import simplejson as json

def json_to_dict(json_str):
return json.loads(json_str)
```

Handles edge cases better, IMO.

Messages In This Thread



Users browsing this thread: 1 Guest(s)