I am going through the Reading data from JSON tiddlers documentation and trying to work out how to implement it so that I can display an externally hosted image just by looking up a key/value pair in a JSON tiddler consisting of URI’s, such as…
my JSON example
{
"coin.png": "https://i.ibb.co/YtXDT9p/coin.png",
"energy.png": "https://i.ibb.co/WnwppcB/energy.png",
"experience.png": "https://i.ibb.co/MgBS0VX/experience.png",
"diamond.png": "https://i.ibb.co/NFKKmN3/diamond.png"
}
I presume that I will need to create a macro which takes the JSON data tiddler name as one parameter, and the search key as a second parameter, and returns the found value, which can then be passed into an <$image>
widget as the source
attribute. Presumably I’ll also need some error handling. Does all of that sound about right? It has been a long time since I last did something like this, so I am looking for a bit of validation here, or gentle nudging towards a better solution. All I’m trying to achieve is to have a simple list of links to my externally hosted images, and then be able to display them by looking up the list as a key/value pair. I want to be able to make these images easily reusable within my wiki, while giving a single point of reference to be able to update the external URI’s whenever needed, without having to chase back to every single tiddler which uses the updated image.