Structured data and schema.org with JSON-LD
Describe your pages to search engines with JSON-LD and schema.org: articles, local businesses, FAQs and more.
In this lesson you will
- Explain what structured data is for
- Write JSON-LD blocks
- Pick the right schema type
- Test your markup
About 14 minutes
Teaching search engines what your page is
Search for a recipe and you often see stars, cooking time and calories right in the results. Search for an event and you see dates and locations. These rich results are not magic. The page owners told the search engine, in a structured form, exactly what each piece of information means. That form is called structured data, and the most popular vocabulary is schema.org.
JSON-LD: the friendly format
Structured data can be written several ways, but the easiest is JSON-LD. It is a block of data inside a script tag, completely separate from your visible HTML, so you can add it without touching your layout.
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Bakery",
"name": "Priya's Bakery",
"url": "https://www.example.com/",
"telephone": "+92-300-0000000",
"address": {
"@type": "PostalAddress",
"streetAddress": "12 Mall Road",
"addressLocality": "Lahore",
"addressCountry": "PK"
},
"openingHours": "Mo-Sa 07:00-18:00"
}
</script>
Read it from the top. @context says which vocabulary we are using, @type says what kind of thing this is, and the other keys are its properties. Nested objects, such as the address, have a type of their own.
Common types worth knowing
ArticleorBlogPostingfor posts, with headline, author, date and image.Productwith price, availability and ratings, for shops.Recipewith ingredients, steps, time and nutrition.FAQPagefor question and answer lists.OrganizationandLocalBusinessfor who you are.BreadcrumbListto show the path to a page in the results.Eventwith date, place and tickets.Coursefor educational content like this one.
Complete this Article JSON-LD by adding the author as a Person named Priya Sharma. The block is data inside a script tag, so it will not show on the page.
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Article",
"headline": "Why sourdough needs patience",
"datePublished": "2026-10-31"
}
</script>
<p>Open the page source to see how it is stored.</p>
Add a comma after the date and an author object with @type Person and name.
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Article",
"headline": "Why sourdough needs patience",
"datePublished": "2026-10-31",
"author": { "@type": "Person", "name": "Priya Sharma" }
}
</script>
<p>Open the page source to see how it is stored.</p>
A blog post example
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "BlogPosting",
"headline": "Why sourdough needs patience",
"image": "https://www.example.com/images/sourdough.jpg",
"author": { "@type": "Person", "name": "Priya Sharma" },
"datePublished": "2026-10-31",
"dateModified": "2026-10-31",
"publisher": {
"@type": "Organization",
"name": "Priya's Bakery",
"logo": { "@type": "ImageObject", "url": "https://www.example.com/logo.png" }
}
}
</script>
An FAQ example
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "FAQPage",
"mainEntity": [{
"@type": "Question",
"name": "Do you deliver?",
"acceptedAnswer": { "@type": "Answer", "text": "Yes, within 10 km for orders over Rs 2,000." }
}]
}
</script>
Google has reduced which sites get FAQ rich results, but the markup still helps other search engines and tools understand the page. Always check the current rules before relying on a specific rich result.
The golden rules
- Mark up what is really on the page. Structured data that does not match the visible content breaks search engine guidelines and can lead to penalties.
- Be accurate and current. A wrong price or old opening hours helps nobody.
- Include the required properties for each type. The documentation lists them.
- Test before you publish. Google’s Rich Results Test and the Schema Markup Validator read your code and report errors.
JSON is picky. A missing comma, a trailing comma after the last item or a straight quote turned curly will make the whole block invalid. Validate it every time.
Where does it go?
Place the script block in the head or the body, anywhere in the document. Search engines find it either way. On WordPress, SEO plugins write it automatically for posts, pages and your organisation, so you will mostly add custom blocks for special content like recipes or events.
Fix the broken JSON-LD: there is a trailing comma and a missing quote. After you fix it, the preview does nothing visible, but you now have valid data.
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Organization",
"name": "Priya's Bakery,
"url": "https://www.example.com",
}
</script>
<p>Valid JSON has quotes closed and no comma after the last item.</p>
Close the quote after Bakery, then delete the comma after the last url line.
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Organization",
"name": "Priya's Bakery",
"url": "https://www.example.com"
}
</script>
<p>Valid JSON has quotes closed and no comma after the last item.</p>
Choosing between plugin and hand-written
If you run your site on WordPress, an SEO plugin handles the common cases: organisation, website, breadcrumbs, articles and often FAQs. Your own JSON-LD becomes useful for content the plugin does not know about, such as a course, a recipe, a local event or a software tool. The key is to avoid duplicating something the plugin already writes. Two conflicting blocks for the same thing confuse search engines. View the page source, search for ld+json, and check what is already there before adding more.
A quick workflow for adding markup
- Decide what the page really is: article, product, event, course or something else.
- Find the type on schema.org and note the required and recommended properties.
- Write the block using your real page data, copying values exactly as they appear on the page.
- Paste it into the Rich Results Test and fix any errors or warnings.
- Publish, then check again after a few days in Search Console, where reports on markup appear.
Check what you learned
Five quick questions. Pick an answer and you will see straight away whether it is right and why.
What is JSON-LD?
- A CSS file
- Structured data in a script block
- A video format
- An image tag
JSON-LD stores structured data in a script tag with type application/ld+json.
What does @type specify?
- The font
- What kind of thing is being described
- The language
- The colour
It names the schema.org type, such as Article or Product.
What is the main rule for structured data content?
- Add as much as possible
- It must match what visitors can see on the page
- It can describe anything
- It must be hidden
Markup that does not match the page can bring penalties.
Which tool tests structured data?
- A spell checker
- Google’s Rich Results Test
- An image editor
- A zip tool
The Rich Results Test and Schema Markup Validator check your code.
What often breaks a JSON-LD block?
- A trailing comma or missing quote
- Using lower case
- Adding spaces
- Adding a heading
JSON is strict about commas and quotes.
Summary
- Structured data labels your content for search engines.
- JSON-LD sits in a script tag, separate from layout.
- Only mark up what is visible and accurate.
- Validate every block before publishing.
Questions
Does structured data guarantee rich results?
No. It makes you eligible, but the search engine decides what to show.
Can I add it with a WordPress plugin?
Yes. Most SEO plugins add it automatically and let you edit key fields.
JSON-LD or microdata?
JSON-LD is easier and is the format search engines recommend.
