Here I will show how to fix an AMP Validator issue "the script tag contains invalid JSON that cannot be parsed".

You might face it while you are working on AMP implementation on your website and it looks like this in AMP validator:

The script tag contains invalid JSON that cannot be parsed in AMP validator

Unfortunately, the validator does only show that some error exists but does not show where and what.

In my case JSON looks like this:

 "@context": "",
 "@type": "NewsArticle",
 "mainEntityOfPage": {
   "@type": "WebPage",
   "@id": ""
 "headline": "ImportError: cannot import name _uuid_generate_random",
 "image": {
   "@type": "ImageObject",
   "url": "",
   "height": 800,
   "width": 800
 "datePublished": "Dec. 9, 2016, 1:10 p.m.",
 "dateModified": "March 6, 2021, 6:20 p.m.",
 "author": {
   "@type": "Person",
   "name": "Ivan Borshchov"
 "publisher": {
    "@type": "Person",
    "name": "Ivan Borshchov",
    "logo": {
      "@type": "ImageObject",
      "url": "",
      "width": 96,
      "height": 96
 "description": "If you have: ImportError: cannot import name _uuid_generate_random Possible you use: `kombu < 3.0.30` \+ `Python 2.7.11` If yes, this bug is fixed in new `ko..."

From first sight, it looks absolutely correct, but actually it is not.

The trick is to use to test the JSON text:

Use JSON validator

Very important is to uncheck Fix JSON, otherwise, it can fix the issue and say it is valid (which was my case and I spent additional time because just saw a green VALID message🤯).

So For me, the issue was in an unescaped backslash:

Actual reason of error

And now it works without a warning: