Product detail page showing this error for some products

Uncaught SyntaxError: Unexpected token B in JSON at position 121<br>
   at JSON.parse (<anonymous>)
   at getData (main.js:58)
   at Array.map (<anonymous>)
   at HTMLDocument.apply (main.js:74)
   at fire (jquery.js:3232)
   at Object.fireWith [as resolveWith] (jquery.js:3362)
   at Function.ready (jquery.js:3582)
   at HTMLDocument.completed (jquery.js:3617)

Please help me to fix this....

  • hey please mark my answers if solve your issue
    – Sourav
    Commented May 21, 2018 at 9:16
  • No luck. Error still there. Commented May 21, 2018 at 9:45
  • deploy content again
    – Sourav
    Commented May 21, 2018 at 9:58

3 Answers 3


So, since you did not specify the code, the error indicates that there are invalid tags in JSON, you need to look in JS for non-closed constructions.


Replace this app/design/frontend/vendor/theme/Magento_Catalog/templates/product/view/gallery.phtml

With this file vendor/magento/module-catalog/view/frontend/templates/product/view/gallery.phtml


I found the solution by renaming the following file:




After that run all magento commands.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.