Class JsonLdScript<T extends JsonLdScript<T>>

java.lang.Object
com.oorian.html.Element<T>
com.oorian.html.elements.Script<T>
com.oorian.html.elements.JsonLdScript<T>
All Implemented Interfaces:
HeadElement

public class JsonLdScript<T extends JsonLdScript<T>> extends Script<T>
Represents a JSON-LD script element for embedding structured data (Schema.org) in HTML pages.

JSON-LD (JavaScript Object Notation for Linked Data) is a method of encoding structured data using JSON. Search engines like Google use this structured data to better understand page content and display rich snippets in search results.

Usage:


 // Create structured data for a software application
 SchemaSoftwareApplication app = new SchemaSoftwareApplication()
     .setName("Oorian")
     .setApplicationCategory("DeveloperApplication")
     .setOperatingSystem("Java");

 // Add to page head
 head.addElement(new JsonLdScript(app));
 
Since:
2025
Version:
1.0
Author:
Claude
See Also:
  • Constructor Details

    • JsonLdScript

      public JsonLdScript(Jsonable schema)
      Constructs a new JSON-LD script element with the specified schema data.

      The script type is automatically set to "application/ld+json" and the schema object is serialized to JSON.

      Parameters:
      schema - The schema object implementing Jsonable (typically a SchemaType subclass)