Vanilla JavaScript Projects

Project 93, SEO and site tools

Schema JSON-LD Builder

Structured data helps search engines understand your page and can earn rich results. This builder turns a short form into clean JSON-LD.

{}
Main API
JSON.stringify
Output
JSON-LD script
Dependencies
None
Your browser
Checking

Build your schema

Choose a type, fill in the fields and watch the JSON-LD update. Missing required fields are flagged.

    How it works

    1. A form per typeEach schema type has its own short list of fields, with the required ones marked. Changing type redraws the form.
    2. Build and cleanForm values are placed into the right schema shape. A JSON.parse reviver then drops empty values and empty objects, so the output stays tidy.
    3. Check before you pasteMissing required fields and obvious mistakes, like a price that is not a number, are listed above the output.
    const product = {
      "@context": "https://schema.org",
      "@type": "Product",
      name: form.name, image: form.image,
      offers: { "@type": "Offer", price: form.price, priceCurrency: "GBP",
                availability: "https://schema.org/InStock" }
    };
    // drop empty values
    const clean = JSON.parse(JSON.stringify(product), (k, v) => v === "" ? undefined : v);
    script.textContent = JSON.stringify(clean, null, 2);