undefined:13
]
^
SyntaxError: Unexpected token ] in JSON at position 267
I have found many similar questions and I assume the problem is that JSON.parse
returns incorrect data with an extra ]
symbol. Probably HTML instead of JSON or something. But the problem is that I can't figure out how to track down where exactly the problem comes from? I have multiple js files with many JSON.parse
included. The answer should be in my error message but I can't figure out where to look at. Line 267 is definitely a wrong answer because it is an empty line in all my files. Thanks.
Full error:
undefined:13
]
^
SyntaxError: Unexpected token ] in JSON at position 267
at JSON.parse (<anonymous>)
at mybp (eval at <anonymous> (/Users/apple/Desktop/UTESTTWO/app/bp.js:39:1), <anonymous>:109:25)
at getaccountdata (/Users/apple/Desktop/UTESTTWO/app/bp.js:64:1)
at Object.<anonymous> (/Users/apple/Desktop/UTESTTWO/app/bp.js:351:1)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/Users/apple/Desktop/UTESTTWO/automatic.js:1:63)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
One option is a bit like playing 21 questions. Remove or comment out calls to half of your code and see if the error persists. That will help you tell which half contains the error. Once you know which half it is, then split the code in that half again. Repeat the process and keep reducing your code in half until you narrow it down to the section that contains the error.
When you don't have much else to go on you sometimes must resort to reduction techniques like this to narrow your scope.