It is a truth universally acknowledged, that a computer man in possession of a JSON file, must be in want of a S-Expression equivalent. And thanks to the good people behind JQ, a lightweight command-line JSON processor, this is not too difficult to achieve.
Its output formatting option is relatively straightforward and flexible.
$ cat c.json
{ "coordinates" : [
{ "x": "1", "y": "0" },
{ "x": "0", "y": "1" },
{ "x": "2", "y": "3" }
] }
$ jq -r '.["coordinates"] |.[] | "X=\(.x) Y=\(.y)"' c.json
X=1 Y=0
X=0 Y=1
X=2 Y=3
It can be used to output the data of, for example, recent ~Club homepage updates, as a string representation of an S-Expression.
#!/usr/bin/env gsi-script
;; ~CLUB INFORMATION
(define club-homepage-updates-json "https://tilde.club/tilde.24h.json")
(define club-homepage-updates-tmp "~/public_html/data/club-homepage-updates.tmp")
(define club-homepage-updates-json-backup "~/public_html/data/club-homepage-updates.json")
(define club-homepage-updates "~/public_html/data/club-homepage-updates.ss")
;; MAGIC JQ COMMAND
;; jq -r '.["pagelist"] |.[] | "((TIMESTAMP . \"\(.modtime)\") (USER . \"\(.username)\") (HOMEPAGE . \"\(.homepage)\") (FILE .\"\"))"' file.json
(shell-command (string-append "curl -s" " " club-homepage-updates-json " > " club-homepage-updates-tmp))
(if (= 0 (car (shell-command (string-append "jq -e . " club-homepage-updates-tmp " >/dev/null") #t)))
(begin
(shell-command (string-append "mv" " " club-homepage-updates-tmp " " club-homepage-updates-json-backup))
(with-output-to-file
club-homepage-updates
(lambda ()
(display
(string-append
"("
(cdr (shell-command
(string-append
"jq -r '.[\"pagelist\"] |.[] | \"((TIMESTAMP . \\\"\\(.modtime)\\\") (USER . \\\"\\(.username)\\\") (HOMEPAGE . \\\"\\(.homepage)\\\") (FILE . \\\"\\\"))\"'" " " club-homepage-updates-json-backup) #t))
")"))))))
His want for an S-Expression equivalent satisfied, the computer continues merrily on his way.