allow running the tests on python 2.5

python 2.5 doesn't have the json module, re.sub doesn't take a flags
argument.