Fix a JSON-LD type array in an event graph
Admin ·
The Night Prints event graph contains a venue node and an event that points to it. The sample is valid JSON, but an integer appears in the event’s type array. Use the validator to locate the entry without downloading the external context.
Locate the number in the event type array
Select Load example. The JSON syntax check passes, and the validator reports one error on line 5 at /@graph/1/@type/1. The pointer identifies the second entry in the second node’s type array. A JSON-LD node can use a type string or an array of type strings.
Replace the number 7 with the quoted string "Event". Keep the event name and the location reference #venue as supplied.
W3C JSON-LD 1.1 grammarW3C JSON-LD 1.1 node objectsIETF RFC 6901, JSON Pointer
Rerun the check and confirm the literal types
Select Validate JSON-LD again. The corrected fixture reports zero errors and zero warnings. Its literal types are Organization, ExhibitionEvent and Event. The note on line 2 records the external context without resolving it.
Download the report and check that the block’s source includes the edited array. The reported types reflect the strings in the source. Context expansion would determine how those names map to identifiers.
Use the second key’s location to resolve a duplicate
To try a second check, add another "name" field next to the event’s existing name. JSON-LD requires unique object keys, so the report points to the duplicate. Choose which value identifies the event before editing. The validator preserves both occurrences in the submitted source.
Common questions
Does every JSON-LD document need a context?
No. Expanded JSON-LD can use full identifiers directly. Compact terms often need a context to define what they mean.
Why are some keyword findings warnings?
An ordinary property can contain raw JSON defined by its context. A warning asks you to verify how those nested values should be interpreted.
Sources
Put it into practice.
Related guides
- How to Check Multiple JSON-LD Scripts in HTML
- How to Create and Check FAQPage Markup
- How to Format and Validate JSON
- Create HowTo JSON-LD From Numbered Steps
- Add Person JSON-LD to an Author Page
- Build Event Markup for a Studio Workshop
- Order a Catalogue Breadcrumb Trail
- Validate Organization Links and Logos