When reading the file using Python 2.7, it transforms most lines into unicode strings, which suggests that maybe the following change could make a difference in your Python 3.2 world:
with open('foobar.json', encoding='utf-8') as foo:
bar = json.load(foo)
# or
bar = json.loads(foo.read())
Detect offending line
If the above doesn't work, you need to find offending json code. One way to do this is simply to remove half of the file and try again. If it still fails, then keep on removing half the file.
If it works, replace the file with the failing part, and start removing halfs again. After a few attempts, you'll be able to locate the offending part of the file, or whether you have a basic reading error of sorts.
To eliminate reading errors, you could try doing a print('file: {}'.format(foo.read()))
in front of the json.loads()
call, just to verify the read contents.
Test json inline
Another test you can try to further eliminate error sources are to take one or a few entries insert into a string and check whether it's the file handling or json handling which gives you the error. Something similar to the following:
json_text= '''
{ "FH45 G34":
{
"surname": "Foo",
"firstName": "Bar",
"address": "1275 Real Street, FooBar",
"postCode": "Foo Bar",
"county": "FooBar"
}
}'''
parsed = json.loads(json_text)
And you could also check if it fails due to the space in the key of the first entry. In other words remove the spaces from a failing entry, primarily in the lefthand side key values.
If these tests are OK, you have some issue with your file read. If they fail, you have some issue with the json module.