How to convert JSON data into a Python object?

I want to convert JSON data into a Python object.

I receive JSON data objects from the Facebook API, which I want to store in my database.

My current View in Django (Python) (request.POST contains the JSON):

response = request.POST
user = FbApiUser(user_id = response['id'])
user.name = response['name']
user.username = response['username']
user.save()
  • This works fine, but how do I handle complex JSON data objects?
  • Wouldn’t it be much better if I could somehow convert this JSON object into a Python object for easy use?

29 Answers
29

Leave a Comment