Reference
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
type |
string | one of type/list | Schema type, 39 supported. |
data |
object | no | Fields as bracket syntax, e.g. data[name]=GLOBUS. |
json |
string | no | The same fields as a JSON object; replaces data. |
url |
string | no | Canonical URL for the schema. |
prettify |
bool | no | Pretty-print JSON. Default: false. |
wrap |
bool | no | Wrap in a script tag with escaped tags. Default: false. |
validate |
bool | no | Reject missing required fields. Default: true. |
list |
bool | no | Return all types with their required fields. |
Example request
curl -s "https://api2.globus.studio/v2/json_ld?type=organization&data%5Bname%5D=GLOBUS&format=json"
A JSON-LD generator writes the structured data block that search engines read from a page. Doing it by hand means remembering which fields a type requires and how nested objects look. The JSON-LD generator takes a type and a flat set of fields, checks the required ones and returns valid JSON-LD.
Thirty-nine types are supported, from Organization and Article to FAQPage, Recipe and JobPosting. The list is read from the same classes that build the output, so it cannot drift from the code.
What the JSON-LD generator returns
A JSON-LD generator call for a single type is one request.
curl -s "https://api.globus.studio/v2/json_ld?type=organization&data[name]=GLOBUS&data[url]=https://globus.studio&prettify=1"
{
"@context": "https://schema.org",
"@type": "Organization",
"name": "GLOBUS",
"url": "https://globus.studio"
}
@context and @type are added for you. Empty fields are dropped, so a form with unused inputs does not produce "description": null in the markup.
Which types exist and what they require
Ask the JSON-LD generator for the list and each entry names its required fields.
curl -s "https://api.globus.studio/v2/json_ld?list=1"
{
"count": 39,
"schemas": [
{"type": "organization", "requires": ["name"]},
{"type": "localbusiness", "requires": ["name", "address"]},
{"type": "article", "requires": ["headline"]},
{"type": "faq", "requires": ["mainEntity"]}
]
}
The list is the reference for validation. article needs a headline, product needs a name, breadcrumb needs itemListElement, and composite needs a list of schemas to merge.
Nested data
Some types hold arrays of objects. Send them as a JSON object in one parameter instead of building bracket syntax by hand.
curl -s "https://api.globus.studio/v2/json_ld?type=faq&json=%7B%22mainEntity%22%3A%5B%7B%22question%22%3A%22Does%20it%20work%3F%22%2C%22answer%22%3A%22Yes.%22%7D%5D%7D"
FAQPage accepts two shapes for an item: question with answer, or question with acceptedAnswer.text. Both produce the same Question and Answer pair in the output.
Validation before publication
The JSON-LD generator validates by default. A missing required field returns a message that names it, which is more useful than publishing markup that a validator will reject a week later.
{"error": true, "message": "Invalid data for schema type: product", "missing_fields": ["name"]}
Pass validate=0 to skip the check when you are assembling a fragment and will fill the field later.
Putting the block on a page
wrap=1 returns the whole script element, ready to paste into a template.
<script type="application/ld+json">{"@context":"https://schema.org","@type":"Organization","name":"GLOBUS"}</script>
Inside the script, <, >, & and quotes are escaped as unicode escapes. A field that contains </script> stays inert instead of closing the block and breaking the page. That case is worth handling in the generator because a product description or a review body can contain anything.
When structured data helps
Rich results are the visible payoff: review stars, FAQ blocks, breadcrumbs, event dates and recipe cards. Google decides which types it shows, and the list changes. Markup that matches the visible page is safe; markup that describes something the visitor cannot see can cost a manual action.
Two rules cover most of it. The data must match the page, and one page should describe one main thing. A product page with four review objects is fine. A blog post marked up as a product to get stars is not.
A page that needs two entities uses composite and passes the parts in order: an article with its author, or a product with its offer and rating. The generator merges them into one graph instead of emitting two script blocks, which is what a validator expects when the entities belong together.
prettify=1 helps while you are writing; minified output is what a template should render.
Related endpoints
To measure whether the text on the page is readable before you publish it, use the readability metrics API. To check the page’s TLS certificate, the TLS certificate API covers the hosting side.
Further reading: Schema.org documentation and Google’s structured data guidelines.