Auth0 Home Blog Docs

Processing Import/Export extension extracts


I’m trying to process JSON files exported from the Import/Export extension but my limited python-fu is failing me. json.loads returns:

ValueError: No JSON object could be decoded

Trying to reformat the file from within vim via:

:%!python3 -m json.tool

Results in:

Unexpected UTF-8 BOM (decode using utf-8-sig): line 1 column 1 (char 0)

Any pointers would be greatly appreciated. There’s some stuff on stackoverflow about using the io module instead of json to read the file but so far that is not helping either:

ValueError: Expecting object: line 1 column 2 (char 1)


And of course, I managed to figure it out after posting. For posterity:

with open('ioa_users.json', encoding='utf-8-sig') as f:
    data = json.load(f)
    for user in data: