Am 14.10.2025 um 12:02 schrieb Henning Hraban Ramm:
Am 08.10.25 um 11:39 schrieb Hans Hagen via ntg-context:
local object = utilities.json.load("myfile.json")
I could probably extend this a bit (and then optimize it performance
wise) but I have zero application for it; typical stuff that evolves
in a project.
How can I load a (JSON) file from an URL?
Since it’s possible with images, I’m sure there’s already a function in
ConTeXt…
Stripped (no file check) down version of the graphics loader.
\starttext
\startluacode
-- grph-inc.lmt + data-bin.lua
local foundname =
resolvers.findbinfile("https://microsoftedge.github.io/Demos/json-dummy-data/64KB.json")
local found, data = resolvers.loadbinfile(foundname)
-- util-jsn.lua
local converted_data = utilities.json.tolua(data)
-- inspect(converted_data)
\stopluacode
\stoptext
Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the
Wiki!
maillist : [email protected] /
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________