Hi everyone, i just run n8n version 1.94.1, trying to use export/import cli command,
when i run n8n export:credentials --all --output=/path/to/folder/ --separate
it export to my folder, but seprate single object per credential format like this: {"createdAt":"2025-07-09T09:24:59.543Z",...}
but when import back by this command import:credentials --input=exportedFile.json
it require a array object format like this [{"createdAt":"2025-07-09T09:24:59.543Z",...}]
i have to edit my exportedFile.json, wrap it by
and then comeback to import,
when you in exporting step, try with n8n export:credentials --backup --output=/your/folder instead of using the output.
or if you want to use --output flags, you need to pass --pretty to more make the json formatted.
Or you can try with n8n import:credentials --separate --input=/your/folder when you’re in importing step
The issue here is that I want to export each credential as a separate file,
but the output format needs to be an array with one credential, as expected by the import command.
For example:
I export all credentials (say, 2 credentials) using --separate.
Expected output:
credential1.json → [{...}]
credential2.json → [{...}]
But actual output is:
credential1.json → {...}
credential2.json → {...}
However, the import command requires the file to be in this format: [{...}].
So I’m forced to manually edit each credential1.json and wrap it in square brackets,
just to be able to import it back again.
you are using the command which expects a single file backup for ALL credentials, this is why it expects a list. If you export with --separate you should also import with --separate.:
Alternatively, if you wish to do it in a more manual and difficult way, you can exec into your n8n container and after running the export command (which creates a bunch of json files in the folder /path/to/folder/, you can run this:
for f in /path/to/folder/*.json; do jq -c '[.]' "$f" > "$f.tmp" && mv "$f.tmp" "$f"; done
This should rewrite each file and surround each file’s object with square brackets [].