JSON bundled with JS Unexpected SyntaxError

52 Views Asked by At

I have a python script that ingests a .txt file and outputs a JSON file. I use linter to ensure that the format of my JSON file is accurate. After, I run my JSON file through this line in terminal:

browserify -g reactify ./directory.js -o ./bundle.js

Which takes the contents of my JSON file and bundles them with my 'directory.js' file and outputs the bundle as 'bundle.js'.

Bundle.js is kept in my static folder for a node.js server that I run. However, when I run my localhost to see the results of my process I receive the error message:

Uncaught SyntaxError: JSON.parse: expected property name or '}' at line 1 column 2 of the JSON data

But I am not sure why. Every step of my process seems to be accurate. If I change different things in my python file, the error message may update to something like 'unexpected s found at line...' or 'unexpected : found'... I can't discern where the problem is.

The only thing that I can think is that somehow, when I bundle my JSON with my directory.js, browserify or reactify is altering the JSON somehow

0

There are 0 best solutions below