dalenguyen / firestore-import-export

An application that can help you to backup and restore from Cloud Firestore | Firebase
https://www.npmjs.com/package/firestore-export-import
401 stars 109 forks source link

Can't import #20

Closed RalfBeckJoergensen closed 5 years ago

RalfBeckJoergensen commented 5 years ago

Hi, Great work... This was just what I needed :-)

I get the following error when trying to import. Export works fine. Hope you can help.

$ node import.js import-to-firestore.json undefined:1 { ^

SyntaxError: Unexpected token  in JSON at position 0 at JSON.parse () at /Users/ralf/Documents/GitHub/firebase/import.js:40:22 at FSReqWrap.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:53:3)

JSON is just for testing a looks like:

{ "songList": { "FpVWamw6LKfxhsdBaNsd": { "artistName": "Muse", "albumName": "The Nightwatcher", "id": "FpVWamw6LKfxhsdBaNsd", "songName": "Sweet Home Alabama", "songDescription": "Deep trouble" }, "PFJJaHZtM53V71na6vM5": { "songDescription": "Desc", "artistName": "Queen", "albumName": "Boehemiam Rapsody", "id": "PFJJaHZtM53V71na6vM5", "songName": "Radio Gaga" }, "WqMHifsWETX3CpiyDjft": { "songDescription": "Germany", "artistName": "Madonna", "albumName": "Summer", "id": "WqMHifsWETX3CpiyDjft", "songName": "Like a Prayer" }, "g9Eja99SlX1EywEMOhOk": { "songDescription": "About winning", "artistName": "Queen", "albumName": "Best of Queen", "id": "g9Eja99SlX1EywEMOhOk", "songName": "We are the Champions" }, "mgNDi0p4FUKFaMJ7Oo7m": { "songDescription": "Ghost Town - desc", "artistName": "Adam Lampert", "albumName": "Best of", "id": "mgNDi0p4FUKFaMJ7Oo7m", "songName": "Ghost Town" }, "kklnILJMKMHLKMLKJNnk": { "songDescription": "Norwegian band", "artistName": "AHA", "albumName": "Fjeldaberne", "id": "123456789", "songName": "Take on me" } } }

RalfBeckJoergensen commented 5 years ago

Got it fixed.. It was the UTF-8 formatting of the document. Needed to copy to Textedit and save as UTF-8.