Synthoid / ExportSheetData

Add-on for Google Sheets that allows data to be exported as JSON or XML.
MIT License
237 stars 46 forks source link

Invalid JSON format when enabling "Ignore empty cells" option #35

Closed cstoquer closed 7 years ago

cstoquer commented 7 years ago

When exporting a JSON file with the "Ignore empty cells" option enabled, if a cell in the last row is empty, then I can get a comma just before a closing brace, which is incorrect JSON formatting and make my NodeJS process fail when I try to do a JSON.parse on it.

Here an example of the data I get (comment added by me to point to the problematic comma)

{
  "test" : [
    {
      "name" : "tacoMan",
      "text" : "hello", // <---- HERE
    },
    {
      "name" : "tacoMan",
      "text" : "Oh, is that a taco... for me?",
      "answers" : [
        "taco:yes, it is for you",
        "notaco: no way!"
      ]
    }
  ]
}
Synthoid commented 7 years ago

This issue is known and is already tagged here. I'm closing this issue since it is a duplicate.