Skip to content
This repository has been archived by the owner on Jan 15, 2021. It is now read-only.

Can't import #20

Closed
RalfBeckJoergensen opened this issue Mar 8, 2019 · 1 comment
Closed

Can't import #20

RalfBeckJoergensen opened this issue Mar 8, 2019 · 1 comment

Comments

@RalfBeckJoergensen
Copy link

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
Copy link
Author

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant