diff options
author | Petri Lehtinen <petri@digip.org> | 2009-09-11 22:22:34 +0300 |
---|---|---|
committer | Petri Lehtinen <petri@digip.org> | 2009-09-11 22:22:34 +0300 |
commit | 9d16ec755c9754fe1f79fe55ab719a7f8578ce37 (patch) | |
tree | d19bb4142d10819cd78a622ebb1afbd56b193f61 | |
parent | 04d550b02e8eadc0c9fb1966fe42fe9fc25f89e0 (diff) | |
download | jansson-9d16ec755c9754fe1f79fe55ab719a7f8578ce37.zip jansson-9d16ec755c9754fe1f79fe55ab719a7f8578ce37.tar.gz jansson-9d16ec755c9754fe1f79fe55ab719a7f8578ce37.tar.bz2 |
test/json-compare.py: Use json module from Python >=2.6 or simplejson
-rwxr-xr-x | test/json-compare.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/test/json-compare.py b/test/json-compare.py index 1db93da..f91530e 100755 --- a/test/json-compare.py +++ b/test/json-compare.py @@ -5,8 +5,11 @@ # Jansson is free software; you can redistribute it and/or modify # it under the terms of the MIT license. See LICENSE for details. -import simplejson import sys +try: + import json +except ImportError: + import simplejson as json def load(filename): try: @@ -17,14 +20,14 @@ def load(filename): sys.exit(1) try: - json = simplejson.load(jsonfile) + jsondata = json.load(jsonfile) except ValueError, err: print "%s is malformed: %s" % (filename, err) sys.exit(1) finally: jsonfile.close() - return json + return jsondata def main(): if len(sys.argv) != 3: |