Content · Web Development · HTML

HTML JSON-LD Script Markup for Structured Data

Learn json-ld script markup for structured data with a clear explanation, practical HTML markup, a walkthrough and common mistakes to avoid.

1 views Published Oct 19, 2026 Updated Oct 19, 2026 Admin

When you publish a webpage, people are not the only ones reading it. Browsers, search engines, and sharing apps also look for clues about its meaning. This lesson explains how json-ld script markup for structured data fits into that picture.

The Idea in Plain English


Structured data adds machine-readable facts about information already visible on the page. Use a supported vocabulary and keep prices, dates, authors and names consistent with the real page.

HTML supplies the structure; JavaScript supplies the behavior described here. If you remove the script, check what remains usable for visitors.

A Working Example


Read the sample once before copying it. Notice the element names and attribute values, then compare them with the explanation below.

<article>
    <h1>Planting a Sunflower</h1>
    <p>By Alex on October 3, 2026</p>
</article>
<script type="application/ld+json">
{
    "@context": "https://schema.org",
    "@type": "Article",
    "headline": "Planting a Sunflower",
    "datePublished": "2026-10-03",
    "author": {
        "@type": "Person",
        "name": "Alex"
    }
}
</script>

What Each Part Does


  • The script element can load code or hold data; the type attribute tells the browser how to treat its contents.
  • An article identifies a self-contained piece of content.
  • The h1 identifies the principal page heading.
  • type chooses the relevant kind of script, input, media or embedded object.

Visitors see the ordinary article; a crawler may read the structured data. Correct markup does not guarantee a search enhancement.

Try It Yourself


Check that the structured data agrees with the article heading, author and publication date.

Common Beginner Mistakes


  • Inventing reviews or adding fields that disagree with visible page content.
  • Changing several parts of the example at once, making it difficult to see which part caused a different result.
  • Choosing a tag only because its default appearance looks right, without checking whether it describes the content correctly.

Key Takeaways


  • Structured data adds machine-readable facts about information already visible on the page. Use a supported vocabulary and keep prices, dates, authors and names consistent with the real page.
  • Visitors see the ordinary article; a crawler may read the structured data. Correct markup does not guarantee a search enhancement.
  • Test the markup in a browser, and check accessibility and real-world behavior where relevant.
Share this resourceSend this page to someone who may find it useful.