amphtml icon indicating copy to clipboard operation
amphtml copied to clipboard

WARNING in G console : "The script tag contains invalid JSON that cannot be parsed"

Open abhiz10 opened this issue 6 years ago • 7 comments

Hi AMP Team,

We are getting a WARNING in G console: "The script tag contains invalid JSON that cannot be parsed"

Ref: https://nature.visualstories.com/paper-recycling-process

But when we validate the above JSON there is no such warning or error reflecting.

abhiz10 avatar Feb 21 '20 06:02 abhiz10

We're experiencing the same exact problem. Google Search console returns this warning:

    "The script tag contains invalid JSON that cannot be parsed"

but validation is successful and no warnings or errors are returned. Google console highlights all amp tags containing JSON like

    <amp-geo layout="nodisplay">
           <script type="application/json">
           {
               "ISOCountryGroups": {
                     "eea": [ "at", "be", "bg", "cy", "cz", "de", "dk", "ee", "es", "fi", "fr",
                          "gb", "gr", "hr", "hu", "ie", "is", "it", "li", "lt", "lu", "lv", "mt", "nl",
                            "no", "pl", "pt", "ro", "se", "si", "sk"]
                  }
            }
           </script>
</amp-geo>

The warnings showed up just a couple of days ago, even though the pages were the same as before, no changes, Maybe a bug in some new version of the validator used by Google console?

mrcferri avatar Feb 21 '20 10:02 mrcferri

Exact the same problem here. 13.000 pages with warnings since yesterday.

itsmsc avatar Feb 21 '20 13:02 itsmsc

This same issue is happening at https://amp.magnetjewelrystore.com/allssgend.html and dozens of other AMP pages on the same domain.

webdevmike avatar Feb 22 '20 00:02 webdevmike

Note, this is just a warning.

/cc @ampproject/wg-caching

jridgewell avatar Feb 22 '20 01:02 jridgewell

Removing all newlines in the the application/json - Tags solves the problem for me. see https://support.google.com/webmasters/thread/29367056?hl=en -> https://twitter.com/westonruter/status/1230920547132792832?s=19

itsmsc avatar Feb 22 '20 11:02 itsmsc

Now, it's not showing any WARNING ....Thanks

abhiz10 avatar Feb 24 '20 04:02 abhiz10

This is being reported as a warning in search console and has no impact on your appearance in search. The issue has already been resolved, but your pages will need to be re-indexed before the warning will disappear.

Gregable avatar Feb 24 '20 21:02 Gregable