Last updated
JSON-LD Validator Examples
The JSON-LD Validator checks structured data markup against Schema.org specifications and Google's rich result guidelines. Below are examples of valid and invalid JSON-LD for common schema types.
Example: Valid Product Schema
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Product",
"name": "Wireless Noise-Cancelling Headphones",
"image": "https://example.com/images/headphones.jpg",
"description": "Premium wireless headphones with active noise cancellation.",
"brand": {
"@type": "Brand",
"name": "AudioTech"
},
"offers": {
"@type": "Offer",
"url": "https://example.com/headphones",
"priceCurrency": "USD",
"price": "149.99",
"availability": "https://schema.org/InStock"
},
"aggregateRating": {
"@type": "AggregateRating",
"ratingValue": "4.5",
"reviewCount": "128"
}
}
</script>
// Validator output:
✓ Valid Product schema
✓ Required: name ✓
✓ Recommended: image ✓, description ✓, brand ✓, offers ✓, aggregateRating ✓
✓ Eligible for: Product rich result with price and rating stars
Example: Invalid Product Schema (Missing Required Fields)
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Product",
"description": "Great headphones",
"price": "149.99"
}
</script>
// Validator output:
✗ Validation errors:
1. Missing required property: "name"
Fix: Add "name": "Your Product Name"
2. Invalid property: "price"
"price" is not a direct property of Product.
Fix: Use "offers": { "@type": "Offer", "price": "149.99", "priceCurrency": "USD" }
3. Missing recommended: image, brand, aggregateRating
Adding these improves rich result eligibility.
Example: Valid Recipe Schema
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Recipe",
"name": "Classic Chocolate Chip Cookies",
"image": "https://example.com/cookies.jpg",
"author": {
"@type": "Person",
"name": "Jane Baker"
},
"datePublished": "2024-01-15",
"description": "The best chocolate chip cookie recipe.",
"prepTime": "PT15M",
"cookTime": "PT12M",
"totalTime": "PT27M",
"recipeYield": "24 cookies",
"recipeCategory": "Dessert",
"recipeCuisine": "American",
"recipeIngredient": [
"2 cups all-purpose flour",
"1 tsp baking soda",
"1 cup butter, softened",
"2 eggs",
"2 cups chocolate chips"
],
"recipeInstructions": [
{
"@type": "HowToStep",
"text": "Preheat oven to 375°F."
},
{
"@type": "HowToStep",
"text": "Mix butter and sugar until fluffy."
},
{
"@type": "HowToStep",
"text": "Add eggs and vanilla, then mix in flour."
},
{
"@type": "HowToStep",
"text": "Fold in chocolate chips and bake 10-12 minutes."
}
],
"aggregateRating": {
"@type": "AggregateRating",
"ratingValue": "4.8",
"ratingCount": "342"
},
"nutrition": {
"@type": "NutritionInformation",
"calories": "180 calories"
}
}
</script>
// Validator output:
✓ Valid Recipe schema
✓ All required properties present
✓ Eligible for: Recipe rich result with rating, cook time, and image
Example: Valid FAQ Schema
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "FAQPage",
"mainEntity": [
{
"@type": "Question",
"name": "What is your return policy?",
"acceptedAnswer": {
"@type": "Answer",
"text": "We offer a 30-day return policy on all items."
}
},
{
"@type": "Question",
"name": "How long does shipping take?",
"acceptedAnswer": {
"@type": "Answer",
"text": "Standard shipping takes 3-5 business days."
}
}
]
}
</script>
// Validator output:
✓ Valid FAQPage schema
✓ 2 questions found
✓ Eligible for: FAQ rich result (expandable Q&A in search results)
Example: Valid Event Schema
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Event",
"name": "JavaScript Conference 2024",
"startDate": "2024-09-15T09:00:00-05:00",
"endDate": "2024-09-17T18:00:00-05:00",
"eventStatus": "https://schema.org/EventScheduled",
"eventAttendanceMode": "https://schema.org/OfflineEventAttendanceMode",
"location": {
"@type": "Place",
"name": "Austin Convention Center",
"address": {
"@type": "PostalAddress",
"streetAddress": "500 E Cesar Chavez St",
"addressLocality": "Austin",
"addressRegion": "TX",
"postalCode": "78701",
"addressCountry": "US"
}
},
"offers": {
"@type": "Offer",
"url": "https://example.com/tickets",
"price": "299",
"priceCurrency": "USD",
"availability": "https://schema.org/InStock"
},
"organizer": {
"@type": "Organization",
"name": "JS Conf Org",
"url": "https://example.com"
}
}
</script>
// Validator output:
✓ Valid Event schema
✓ Eligible for: Event rich result with date, location, and ticket price
Common Validation Errors
Error: Wrong date format
✗ "startDate": "September 15, 2024"
✓ "startDate": "2024-09-15" or "2024-09-15T09:00:00-05:00"
Error: Missing @context
✗ { "@type": "Product", "name": "Widget" }
✓ { "@context": "https://schema.org", "@type": "Product", "name": "Widget" }
Error: Invalid enum value
✗ "availability": "InStock"
✓ "availability": "https://schema.org/InStock"
Error: Wrong property name
✗ "recipeIngredients": [...] (plural)
✓ "recipeIngredient": [...] (singular)
Error: String where object expected
✗ "author": "Jane Baker"
✓ "author": { "@type": "Person", "name": "Jane Baker" }
Paste your JSON-LD structured data to validate it against Schema.org specifications and check eligibility for Google rich results.