mongodbimport Failure - FailedToParse: Expecting '{': offset:0

10.6k Views Asked by At

I tried to import a 7.4 MB JSON file via ...

mongoimport -d mongoimport -c test --file jsonTest.json

But I saw this issue.

Wed Sep 04 13:08:52.378 exception:BSON representation of supplied JSON is too large: code FailedToParse: FailedToParse: Expecting '{': offset:0

This Stackoverflow post presented a similar issue with respect to the date occurring before Jan 1, 1970, but that doesn't seem to apply given my FailedToParse: Expecting '{': offset:0 error.

2

There are 2 best solutions below

1
On

seems I'm much late but with the correct answer:

add --jsonArray in your statement and it will work. It should read like:

mongoimport -d mongoimport -c test --file jsonTest.json --jsonArray

Cheers!!

2
On

Make sure that your json file is formatted correctly...Remove ' [ ' brackets at starting and ending if present. Check your json if you have any empty lines. Also check that the json documents have to separated by a new line..