On 10/8/2025 10:25 AM, Henning Hraban Ramm wrote:
Am 08.10.25 um 10:00 schrieb mf:
you don't need the \usemodule any more.
local object = utilities.json.load("myfile.json")
and you get your json as a lua table.
Thank you!
I need to run it on a server with TeXlive 2023, and there the module is
still needed. But it works, and the code is much simpler than before.
Here is your monthly undocumented feature:
\usemodule[json]
\starttext
\startluacode
local t = {
a = {
b = {
c = "here",
}
},
b = "there",
d = { 1, 2, 3, 4 },
}
utilities.tablestore.load("crap",t)
io.savedata("oeps.json",utilities.json.tojson(t))
\stopluacode
\tablefield {crap}{a.b.c}
\tablefield {crap}{b}
\tablelength{crap}{d}
\loadtable[whatever][oeps.json]
\tablefield {whatever}{a.b.c}
\tablefield {whatever}{b}
\tablelength{whatever}{d}
\stoptext
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.
Hans
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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
___________________________________________________________________________________