How to Fix '@context Missing' Errors in JSON-LD

By Ryan York

Learn how to identify and fix missing @context declarations in your JSON-LD structured data that can cause Rich Results testing tool warnings.

What Does '@context Missing' Mean in Schema.org and How Do You Fix It?

When working with JSON-LD structured data, one of the most common errors you'll encounter is the missing @context declaration. This error can prevent your structured data from being properly understood by search engines and other systems that consume schema.org markup.

What is @context?

The @context property in JSON-LD defines the vocabulary being used in your structured data. It tells processors how to interpret the properties and values in your JSON-LD document. For schema.org structured data, the context should always be set to "https://schema.org".

Common Error Scenarios

Missing @context at Root Level

The most basic error occurs when the @context is completely missing from your JSON-LD script:

{
  "@type": "Organization",
  "name": "Example Company",
  "url": "https://example.com"
}

Fix: Add the schema.org context at the root level:

{
  "@context": "https://schema.org",
  "@type": "Organization", 
  "name": "Example Company",
  "url": "https://example.com"
}

Nested Objects Without Context

When you have nested objects that reference schema.org types, they may need their own context declaration:

{
  "@context": "https://schema.org",
  "@type": "Article",
  "headline": "Sample Article",
  "author": {
    "@type": "Person",
    "name": "John Doe"
  }
}

In most cases, nested objects inherit the context from their parent, so the above example is correct. However, if you're combining multiple vocabularies or have complex nesting, you may need to be more explicit.

Multiple Schema Types

When defining multiple schema types in a single JSON-LD block using an array, ensure the context is properly defined:

{
  "@context": "https://schema.org",
  "@graph": [
    {
      "@type": "Organization",
      "name": "Example Company"
    },
    {
      "@type": "WebSite", 
      "name": "Example Website",
      "publisher": {
        "@id": "#organization"
      }
    }
  ]
}

Testing Your Fix

After adding the missing @context declarations:

  1. Use Google's Rich Results Test: Enter your page URL or paste your JSON-LD directly into the testing tool
  2. Check the Structured Data Testing Tool: Validate that your markup is properly recognized
  3. Monitor Search Console: Watch for structured data errors in Google Search Console

Best Practices

  • Always include @context at the root level of your JSON-LD
  • Use the full schema.org URL: "https://schema.org"
  • If combining multiple vocabularies, consider using a context object instead of a simple string
  • Test your structured data after making changes

Missing @context often occurs alongside other JSON-LD issues:

  • Invalid property names
  • Incorrect nesting structures
  • Mixed vocabulary usage
  • Malformed JSON syntax

Conclusion

The @context property is fundamental to JSON-LD and should never be omitted from your structured data. By following the patterns shown above and regularly testing your markup, you can ensure your schema.org data is properly formatted and recognized by search engines.

Remember: every JSON-LD script block should start with a proper @context declaration pointing to the vocabulary you're using.