Invalid structured data: fixing JSON-LD missing @context or @type

Invalid structured data, in this audit, means a JSON-LD block on the page does not declare @context (normally https://schema.org) or @type (what the thing is, such as Article) at its top level. Without @context, parsers do not know the vocabulary; without @type, they do not know what is being described. Fix it by adding both to the block.

There is one common false alarm. Many plugins wrap several entities in an @graph array, which has @context at the top and a @type on each item inside, but no top-level @type. That is valid JSON-LD, and if Google's Rich Results Test reads it correctly, you can leave it alone.

What it looks like in the HTML

Before

html
<script type="application/ld+json">
{
  "headline": "Cold Brew at Home",
  "author": { "name": "Priya Rao" }
}
</script>

After

html
<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "Article",
  "headline": "Cold Brew at Home",
  "author": { "@type": "Person", "name": "Priya Rao" }
}
</script>

Why it matters

Structured data only works if machines can interpret it. A block with no @context is just JSON with no vocabulary: the word "headline" means nothing until it is tied to schema.org. A block with no @type does not say whether it describes an article, a product or an event. Either way, Google cannot use it for rich results, and the effort that went into it is wasted.

This check is structural. It does not test whether the data is complete for a given rich result; Google's Rich Results Test does that. Note also that a block with a JSON syntax error, such as a missing comma, cannot be parsed at all, so this audit will not count it, and the page may show as having no structured data instead.

Common causes

  • Hand-pasted snippets. Markup copied from a tutorial or generator with the first lines trimmed off, or pasted into a Custom HTML block with a piece missing.
  • Theme or plugin fragments. A theme that prints partial markup, or a plugin that outputs an object meant to be merged into another block.
  • Arrays at the top level. Some tools output [ {...}, {...} ]. Each object inside may be valid, but the array itself has no top-level @context, so this check flags it. Google accepts this form; confirm with the Rich Results Test.
  • @graph wrappers, as described above. Valid, but flagged by this check.
  • Typos in keys. "@Type", "type" or "context" without the @ are not the same properties.

How to fix it in WordPress

  1. Find the block. View source, search for application/ld+json, and read each block. Note which plugin or theme printed it; HTML comments and nearby markup usually give it away.
  2. Fix hand-written markup. If the block is in a Custom HTML block or a code snippet, add "@context": "https://schema.org" and the right "@type" at the top, and give nested objects their own @type (an author should be a Person or Organization).
  3. Replace fragile markup with generated markup. Hydrogen SEO builds JSON-LD from fields: set site-wide types on its Schema screen, or a per-page type in the SEO Settings sheet (Ctrl+E or Cmd+E). Once it covers the page, remove the hand-pasted block so you do not have two.
  4. Remove duplicates. If two plugins or a plugin and the theme both print schema, pick one source. Duplicate blocks often disagree and confuse validators.
  5. Check performance plugins. Script-combining or delay features occasionally rewrite ld+json blocks. Exclude them if they are being altered.

When you can ignore this warning

If the flagged block is an @graph wrapper or a top-level array, run the page through Google's Rich Results Test and the Schema.org validator. If both read every item with its correct type and report no errors, the markup is fine and you can move on. See the schema markup guide for how the common types fit together.

How to check the fix

Test the live URL, not a pasted snippet, in Google's Rich Results Test at search.google.com/test/rich-results and in validator.schema.org. Purge any page cache first so the tools fetch the updated HTML. Rerun the free SEO audit to confirm the warning has cleared.

Common questions

What does @context do in JSON-LD?

It tells parsers which vocabulary the property names come from, almost always schema.org. Without it, the names have no defined meaning.

Is @graph valid JSON-LD?

Yes. @graph is a standard way to put several related entities in one block. Each item inside needs its own @type.

Will invalid schema get my site penalized?

Broken markup is simply not used. Penalties are for misleading markup, such as fake reviews, not for syntax mistakes.