Skip to content

Instantly share code, notes, and snippets.

@berdario
Created October 26, 2015 23:40
Show Gist options
  • Save berdario/483819c62afb24f75ef2 to your computer and use it in GitHub Desktop.
Save berdario/483819c62afb24f75ef2 to your computer and use it in GitHub Desktop.
import json
from collections import namedtuple
Duh = namedtuple('Duh', 'foo bar')
json.loads('{"foo":1, "bar":2}', object_hook=lambda x: Duh(**x))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment