Created
November 14, 2016 08:52
-
-
Save AnasAboreeda/522f6e071cd8df0109e67df8e1ec42b8 to your computer and use it in GitHub Desktop.
Parse Json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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