Self-describing JSON-LD views. Data that knows how to display itself.
W3C Proposal →JSON-LD describes what data is, but not how to display it. Processors must maintain type mappings, limiting extensibility.
Add @view to JSON-LD. Data hints at its preferred renderer. Processors that support it load the view; others ignore it.
{
"@context": { "schema": "http://schema.org/" },
"@type": "schema:Person",
"@view": "https://jsonos.com/examples/src/panes/person.js",
"schema:name": "Marie Curie",
"schema:jobTitle": "Physicist"
}
Data carries its own display hint. No external configuration needed.
Anyone can publish views. No central registry required.
Processors that don't support @view simply ignore it.
New types get views immediately. No processor updates needed.
With solid-shim, rendering @view is one line:
<!-- Your self-describing data --> <script type="application/ld+json"> { "@type": "schema:Person", "@view": "https://jsonos.com/examples/src/panes/person.js", "schema:name": "Marie Curie" } </script> <!-- solid-shim auto-renders when @view is present --> <script src="https://unpkg.com/solid-shim/dist/mashlib.min.js"></script>
That's it. The presence of @view triggers automatic rendering.
When solid-shim encounters @view, it:
render(subject, context)// Pane module structure (ES Module) export default { name: 'myPane', render(subject, context) { const store = context.session.store; const div = document.createElement('div'); // Render logic... return div; } };
This pattern exists elsewhere:
<?xml-stylesheet?> - XML declares its stylesheet<link rel="stylesheet"> - HTML declares its CSSpotentialAction - Schema.org hints at available actionsThe Live Editor supports @view. Add it to any JSON-LD and watch it load your custom pane.
Open Live Editor →