Home / Fix guides / Structured data and AI search

How to fix invalid JSON-LD structured data errors

Invalid JSON-LD almost always comes down to a small typing mistake, such as a stray comma or an unescaped quote, that makes the whole block unreadable. Find the line with a free validator, correct it, and test the page again.

Invalid JSON-LD means the block of structured data in your page's code has a syntax error, so Google and other machines cannot read it. The page looks normal to visitors, but the extra facts you meant to share about your business, products or articles are ignored until the error is corrected.

What the problem is and what you see

JSON-LD is a small block of data inside a <script type="application/ld+json"> tag. It states facts such as your business name, phone number, opening hours, product prices or FAQ answers in a format machines understand. It follows strict JSON rules. One missing comma or stray quote makes the whole block unreadable, not just the broken line.

Visitors see nothing wrong. You usually find out in one of these ways:

  • Google Search Console shows an error such as "Unparsable structured data" in the structured data or enhancement reports.
  • The Rich Results Test or the Schema Markup Validator reports a parsing error, often with a line number.
  • Rich results that used to appear (review stars, prices, FAQ dropdowns) disappear.

Why it matters

Search engines skip a block they cannot parse. That means the page cannot qualify for rich results based on that data. Valid markup does not guarantee rich results either, but broken markup rules them out.

Structured data also gives search engines and AI tools a clean, machine readable statement of who you are and what you sell. When it is broken, they have to guess from the visible page text instead. For a small business, that can mean wrong or missing details in search listings, which costs trust and enquiries.

How to check your site for free

  1. Open the Rich Results Test (search.google.com/test/rich-results), enter a page address and run it. Look for parsing errors.
  2. Try the Schema Markup Validator (validator.schema.org). It checks general schema.org syntax, not only what Google supports.
  3. In Google Search Console, open the structured data related reports and look for pages flagged as unparsable.
  4. For a manual check, view the page source, search for ld+json, copy the contents of the script tag and paste them into a JSON checker such as jsonlint.com. It points to the line that breaks.

Test several page types (home page, a product or service page, a blog post). Different templates often output different blocks, and only one may be broken.

The most common mistakes

MistakeWhat it looks likeFix
Trailing commaA comma after the last item before } or ]Delete that comma
Missing commaTwo items on separate lines with no comma betweenAdd a comma after the first item
Curly quotes“Shop” pasted from a word processorReplace with straight double quotes
Single quotes'name'Use double quotes for names and values
Unescaped quote in textA description containing a double quoteWrite it as \" or remove it
Line break inside a text valueA description pasted over two linesKeep it on one line or use \n
Comments// note or /* note */Remove them, JSON has no comments
HTML inside the script tagTags or stray text around the dataOnly JSON belongs inside the tag

Here is a small broken example. The comma after the last line is the error:

{
  "@context": "https://schema.org",
  "@type": "LocalBusiness",
  "name": "Example Bakery",
}

How to fix it

  1. Find where the block comes from. It may be a plugin, a theme file, an app, a tag manager tag or code typed by hand.
  2. Copy the block into a JSON checker and fix the line it reports. Fix one error, then check again, because there can be several.
  3. Make the change at the source, not in the page's live output, or it will be overwritten next time the page is rebuilt.
  4. If the data comes from form fields (descriptions, product titles), remove or escape quotes and line breaks in the text. Quotes in product names are a very common cause.
  5. If a plugin or app generates the broken block and you cannot edit it, check its settings for a schema option, update it, or turn its schema output off and use one source only.
  6. After the syntax is valid, check that required fields are present. A block can parse correctly and still be missing fields Google needs (see missing required schema fields).

Common platforms

Where things live depends on your version and theme, so treat these as starting points.

  • WordPress: schema usually comes from an SEO plugin, a dedicated schema plugin or the theme. Look in the plugin's schema or search appearance settings. Two plugins outputting schema at once is a common cause of messy blocks. See the WordPress guide.
  • Shopify: product schema is often in the theme files (look for ld+json in the product template or a snippet), and apps can add more. Search the theme code for it.
  • Webflow: custom code is added in page settings or site settings under custom code. Check what was pasted there.
  • Google Tag Manager: a Custom HTML tag may contain the script. Check the tag and its trigger.
  • Next.js, React and Magento: the block is generated by code or a template, so a developer should fix the template and make sure text values are safely encoded (for example with JSON.stringify).

If you are not comfortable editing theme files, send the validator's error message and the page address to your developer. It is usually a quick fix.

How to confirm the fix worked

  1. Run the page again in the Rich Results Test and the Schema Markup Validator. The parsing error should be gone.
  2. View the live page source (not just the editor) to make sure the corrected block is what is actually published. Clear any caching plugin or CDN cache first.
  3. In Search Console, use the validate fix option on the report if one is offered. Google rechecks over days to weeks, so the error may stay listed for a while.

If the error persists, see the broader guide on unparsable structured data.

How to stop it coming back

  • Test one page of each type after every theme change, plugin update or new app install.
  • Use one source of schema per site, not a plugin plus hand pasted code plus an app.
  • Never paste code from a word processor or chat window straight into a live site. Curly quotes sneak in that way.
  • Check any template that inserts free text into schema, such as descriptions and product names, for quotes and line breaks.
  • Keep a quick check on a schedule. SiteMonday's week 16 structured data service looks at your schema and reports problems like this in a ranked fix list, but the free tools above work too if you run them regularly.

Step by step for your platform

Questions

What does invalid JSON-LD mean?

It means the structured data block on your page breaks the JSON rules, for example with a stray comma or unescaped quote. Because of that, search engines cannot read any of it.

Will invalid JSON-LD hurt my Google rankings?

Google does not treat it as a penalty, but the data is ignored, so you lose eligibility for rich results. Your normal page content is still indexed.

Why does the validator say the page is fine but Search Console shows an error?

Search Console reports on what Google last crawled, which can be older than your fix. Test the live page, then use the validate fix option and allow time for a recrawl.

Can I fix JSON-LD errors without a developer?

Often yes, if the block comes from a plugin setting or a pasted snippet. If it sits in theme code or a custom template, it is safer to have a developer make the change.

Can a plugin cause invalid JSON-LD?

Yes. A plugin may output broken markup, or two plugins may output overlapping blocks. Check the plugin's schema settings, update it, or switch off one of the sources.

Does valid JSON-LD guarantee rich results?

No. Valid syntax is the first step. Google also needs the right fields, accurate content that matches the page, and it decides whether to show rich results.

Related problems