JSON-LD Syntax and Structure
What you'll learn: You'll master the fundamental building blocks of JSON-LD syntax—@context, @type, and property-value pairs—to write valid structured data for search engines.
The Core Idea
Think of JSON-LD structured data like a standardized business card for your web content. Just as a business card has specific fields (name, title, company), JSON-LD uses special keywords to tell search engines exactly what your content represents and what properties it has.
The Three Essential Elements
1. @context — This declares the vocabulary you're using. It's like saying "I'm speaking Schema.org language" so search engines know how to interpret your terms:
"@context": "https://schema.org"
2. @type — This defines what kind of thing you're describing (Person, Article, Product, etc.):
"@type": "Article"
3. Property-value pairs — These are the actual details about your entity, written as standard JSON:
"headline": "JSON-LD Guide",
"author": "Jane Doe"
A Complete Example
{
"@context": "https://schema.org",
"@type": "Article",
"headline": "Understanding JSON-LD",
"author": {
"@type": "Person",
"name": "Jane Doe"
},
"datePublished": "2024-01-15"
}
Notice how the author property contains a nested object with its own @type. This is valid JSON-LD—you can nest structured entities just like regular JSON objects.
Why This Format?
JSON-LD lives in a <script type="application/ld+json"> tag, completely separate from your visible HTML. This separation means you can add rich metadata without touching your page structure, and it's far easier to generate programmatically than microdata or RDFa.
Key Takeaway: JSON-LD requires three core elements—@context to set the vocabulary, @type to declare the entity type, and standard JSON property-value pairs to describe its attributes.