Created
September 3, 2010 18:51
-
-
Save gbishop/564357 to your computer and use it in GitHub Desktop.
This file contains 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
# monkey patch the python json module to handle undefined | |
import json | |
json.decoder._CONSTANTS['undefined'] = None | |
json.scanner.pattern('(-?Infinity|NaN|true|false|null|undefined)')(json.decoder.JSONConstant) | |
json.decoder.JSONScanner = json.decoder.Scanner(json.decoder.ANYTHING) | |
if __name__ == '__main__': | |
print json.loads('{ "foo": 1, "bar": undefined }') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment