Skip to content

Instantly share code, notes, and snippets.

@AnasAboreeda
Created November 14, 2016 08:52
Show Gist options
  • Save AnasAboreeda/522f6e071cd8df0109e67df8e1ec42b8 to your computer and use it in GitHub Desktop.
Save AnasAboreeda/522f6e071cd8df0109e67df8e1ec42b8 to your computer and use it in GitHub Desktop.
Parse Json
def byteify(input):
if isinstance(input, dict):
return {byteify(key): byteify(value)
for key, value in input.iteritems()}
elif isinstance(input, list):
return [byteify(element) for element in input]
elif isinstance(input, unicode):
return input.encode('utf-8')
else:
return input
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment