User Export/Import JSON Issues

Not sure if im doing something wrong but when I create a user export, using either the dashboard extension or the jobs api endpoint, the resulting json file is not valid. Instead of having an array of user objects it has multiple user objects in the root.
So when I try and upload the same file to a different tenant Auth0 says Users import failed with a message Failed to parse users file JSON when importing users. Make sure it is valid JSON.

Shouldnt a file exported from Auth0 be able to be imported?

Hi @Beanie

The export is done in the ndjson format, but the import requires a properly formatted json. Before you can import users, you’ll need to convert from ndjson to json, as stated here User Import / Export Extension

Auth0 uses the ndjson format due to the large size of export files

Regarding the conversion from ndjson to json, you can use the jq library https://stedolan.github.io/jq/ as:

cat input.json | jq -s > output.json

It will convert the ndjson file you get from the extension:

{"user_id": ...}
{"user_id": ...}
{"user_id": ...}

Into a valid json file:

[
  {"user_id": ...},
  {"user_id": ...},
  {"user_id": ...}
]
1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.