Skip to content

Instantly share code, notes, and snippets.

@matyasfodor
Last active July 16, 2017 19:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matyasfodor/2798a54ca3a6b1ac9abd8edfe000b71c to your computer and use it in GitHub Desktop.
Save matyasfodor/2798a54ca3a6b1ac9abd8edfe000b71c to your computer and use it in GitHub Desktop.
This is how to parse JSON as object (recursively)
import json
from collections import namedtuple
x = json.loads(data, object_hook=lambda d: namedtuple('X', d.keys())(*d.values()))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment