Skip to content

Instantly share code, notes, and snippets.

@mpobrien
Created January 17, 2012 18:48
Show Gist options
  • Save mpobrien/1628091 to your computer and use it in GitHub Desktop.
Save mpobrien/1628091 to your computer and use it in GitHub Desktop.
def handler(obj):
if hasattr(obj, 'isoformat'):
return obj.isoformat()
else:
raise TypeError, 'Object of type %s with value of %s is not JSON serializable' % (type(obj), repr(obj))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment