Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase - Invalid JSON data or key values. Key values can’t contain $ # [ ] / or

I'm trying to import my JSON file into my Firebase but it keeps giving me this error. I don't know why this JSON file isn't allowed to be imported into since JSONLint says it's a valid JSON file.

Here's the file:

{
  "Featured" : {
      "artist" : "james turell",
      "artistEPK" : "artistsownepk.pdf",
      "author" : "john queue author",
      "date" : "7/28/2016",
      "fullScreenImg" : "https://firebasestorage.googleapis.com/v0/b/wallplay-a8440.appspot.com/o/Screen%20Shot%202016-06-08%20at%2012.00.06%20PM.png?alt=media&token=1df5d60d-808c-48bb-a591-e005f82e4687",
      "linksToMedia" : [ "www.wallplay.com/project-name/james-t/press.html" ],
      "linksToPress" : [ "" ],
      "location" : "10 Main Street",
      "mainImg" : "https://firebasestorage.googleapis.com/v0/b/wallplay-a8440.appspot.com/o/Screen%20Shot%202016-06-08%20at%2012.00.06%20PM.png?alt=media&token=1df5d60d-808c-48bb-a591-e005f82e4687",
      "pressImgs" : [ "https://firebasestorage.googleapis.com/v0/b/wallplay-a8440.appspot.com/o/Screen%20Shot%202016-06-08%20at%2012.00.06%20PM.png?alt=media&token=1df5d60d-808c-48bb-a591-e005f82e4687", "https://firebasestorage.googleapis.com/v0/b/wallplay-a8440.appspot.com/o/Screen%20Shot%202016-06-08%20at%2012.00.06%20PM.png?alt=media&token=1df5d60d-808c-48bb-a591-e005f82e4687", "https://firebasestorage.googleapis.com/v0/b/wallplay-a8440.appspot.com/o/Screen%20Shot%202016-06-08%20at%2012.00.06%20PM.png?alt=media&token=1df5d60d-808c-48bb-a591-e005f82e4687" ],
      "pressRelease" : "projectpressrelease.pdf",
      "projectImgs" : [ "https://firebasestorage.googleapis.com/v0/b/wallplay-a8440.appspot.com/o/Screen%20Shot%202016-06-08%20at%2012.00.06%20PM.png?alt=media&token=1df5d60d-808c-48bb-a591-e005f82e4687", "https://firebasestorage.googleapis.com/v0/b/wallplay-a8440.appspot.com/o/Screen%20Shot%202016-06-08%20at%2012.00.06%20PM.png?alt=media&token=1df5d60d-808c-48bb-a591-e005f82e4687", "https://firebasestorage.googleapis.com/v0/b/wallplay-a8440.appspot.com/o/Screen%20Shot%202016-06-08%20at%2012.00.06%20PM.png?alt=media&token=1df5d60d-808c-48bb-a591-e005f82e4687" ],
      "projectSubheader" : "subheader of project",
      "projectTitle" : "title of project",
      "projectURL" : "",
      "soundFile" : [ ],
      "text" : "here there would be a text for james turell",
      "videoURL" : ""
    },
  "Future" : {

  },
  "Past" : {

  },
  "Present" : {

  }
}

the issue happens when importing json using the web interface

enter image description here

like image 596
Homerdough Avatar asked Jul 29 '16 22:07

Homerdough


People also ask

What is an invalid JSON value?

Usually used when non-well-formed content (content that does not conform to JSON syntax as per specification) is encountered. For further details see the "Raw Error Message" and the additional messages” Error: “Invalid UTF-8 start byte” Error: “An error occurred indicating a json parsing problem.

Which character Cannot be part of string data within JSON?

Any valid string can be used as a JSON key. The following characters are invalid when used in a JSON key: " (double quote) – It must be escaped. \ (backslash) – It must be used to escape certain characters. all control characters like \n , \t.


1 Answers

I just spent some time on this and found the issue for me (and likely for many others) when getting this error message. It looks like firebase can only import files with UTF-8 encoding (no BOM)

I found it strange, as I couldn't re-import the content I had just exported.

I tried all UTF versions 8, 16 with LE and BE with and without BOM, only UTF-8 works

I wish firebase did not have this utterly misleading error message

enter image description here

like image 113
Daniel Avatar answered Sep 19 '22 17:09

Daniel