How to Create JSON-LD
A step-by-step tutorial for creating JSON-LD structured data from scratch, including choosing types, adding properties, and validating output.
Creating JSON-LD structured data is straightforward once you understand the pattern. This tutorial walks you through the entire process — from identifying the right schema type to validating your output with Google’s tools.
Step 1: Identify Your Content Type
Before writing any code, determine what kind of content your page represents:
| If Your Page Is… | Use This Schema Type |
|---|---|
| A blog post or article | Article or BlogPosting |
| A product page | Product |
| An FAQ section | FAQPage |
| A business listing | LocalBusiness |
| A person/author profile | Person |
| A recipe | Recipe |
| An event | Event |
| Your homepage | WebSite + Organization |
Step 2: Start With the Boilerplate
Every JSON-LD block follows this structure:
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "YourType",
"property1": "value1",
"property2": "value2"
}
</script>
The @context is always https://schema.org. The @type is the Schema.org type you identified in Step 1.
Step 3: Add Required Properties
Check Google’s structured data documentation for the required properties of your chosen type.
For an Article, the required properties are:
{
"@context": "https://schema.org",
"@type": "Article",
"headline": "How to Create JSON-LD",
"image": "https://example.com/article-image.png",
"datePublished": "2026-06-12",
"author": {
"@type": "Person",
"name": "Sanjay Samanta"
}
}
Step 4: Add Recommended Properties
Recommended properties improve your chances of getting rich results:
{
"@context": "https://schema.org",
"@type": "Article",
"headline": "How to Create JSON-LD",
"image": "https://example.com/article-image.png",
"datePublished": "2026-06-12",
"dateModified": "2026-06-12",
"author": {
"@type": "Person",
"name": "Sanjay Samanta",
"url": "https://opengraphgenerator.com/authors/sanjay-samanta"
},
"publisher": {
"@type": "Organization",
"name": "Open Graph Generator",
"logo": {
"@type": "ImageObject",
"url": "https://opengraphgenerator.com/logo.png"
}
},
"description": "A step-by-step tutorial for creating JSON-LD structured data.",
"mainEntityOfPage": "https://opengraphgenerator.com/blog/how-to-create-json-ld"
}
Step 5: Place the Script Tag
Add the <script type="application/ld+json"> block to your page. Google supports JSON-LD in either the <head> or <body>, but best practice is to place it in the <head> for consistency.
See Where to Put JSON-LD in HTML for detailed placement guidance.
Step 6: Validate
Before deploying, validate your JSON-LD with these tools:
- Google Rich Results Test — Paste your URL or code snippet to see if Google can parse it and which rich results it qualifies for.
- Schema Markup Validator — Checks syntax against the full Schema.org vocabulary.
- JSON syntax validator — Run your JSON through any JSON linter to catch syntax errors (missing commas, unclosed brackets).
For a complete validation workflow, see How to Validate JSON-LD.
Common Mistakes to Avoid
- Invalid JSON syntax — Missing commas, extra trailing commas, and unescaped quotes are the most common errors.
- Wrong
@type— Using"WebPage"instead of"Article"for blog posts won’t qualify for article rich results. - Missing required properties — Google silently ignores schemas that lack required fields.
- Using relative URLs — Always use full, absolute HTTPS URLs for
image,url, andmainEntityOfPage.
Related Resources
- What Is JSON-LD? — Background and introduction.
- JSON-LD Examples: Complete Guide — Ready-to-use code snippets.
- Where to Put JSON-LD in HTML — Placement best practices.
- Application/LD+JSON Explained — Understanding the MIME type.