The :json: protocol fetches external JSON APIs and maps their
data to Alap link items. Unlike :web: which guesses field names,
:json: uses explicit configuration: a declared root path, precise
field mapping, envelope metadata extraction, and template interpolation.
Every :json: source is defined in the config with three key parts:
${1} template vars for dynamic queriessources: {
artic: {
url: 'https://api.artic.edu/api/v1/artworks/search?q=${1}&limit=12',
root: 'data',
envelope: { iiif_url: 'config.iiif_url' },
fieldMap: {
label: 'title',
url: 'https://www.artic.edu/artworks/${id}',
image: '${_envelope.iiif_url}/${image_id}/full/843,/0/default.jpg',
},
},
}
| Source | API | Features Demonstrated |
|---|---|---|
| countries_europe | REST Countries | Bare array, nested fields (name.common), thumbnails |
| music_albums | TheAudioDB | Positional URL args (${1}), root path, thumbnails, genre tags |
| artic | Art Institute of Chicago | Envelope template vars (${_envelope.iiif_url}), IIIF images |
| wikimedia | Wikimedia Commons | Nested image info (imageinfo[0].thumburl), HTML stripping on artist/description |
| openlibrary | Open Library | Template URLs for covers, author arrays |
| loc_search | Library of Congress (Search) | Rich metadata: dates, contributors, formats, locations |
Each sub-page demonstrates the same :json: sources rendered through
a different Alap renderer. The config stays the same — only the UI changes.