1. Richo Healey
  2. ident.so

Commits

Richo Healey  committed 793625f

Add super ghetto json implementation

  • Participants
  • Parent commits db02ac7
  • Branches master

Comments (0)

Files changed (2)

File lib/json.scm

View file
  • Ignore whitespace
+(define elem->jsonobj
+  (lambda (elem)
+    (cond ((string? elem)
+           (string-append "\"" elem "\""))
+          ((number? elem)
+           (number->string elem))
+          (else ; TODO
+            elem))))
+
+(define alist->json
+  (lambda (alst)
+    (string-append "{"
+      (string-intersperse (map (lambda (pair)
+                                 (string-intersperse (list (elem->jsonobj (car pair)) (elem->jsonobj (cadr pair))) ":")
+                                 ) alst) ",") "}" )))
+
+
+

File main.scm

View file
  • Ignore whitespace
 ; (require-extension intarweb)
 
 (require "lib/util")
+(require "lib/json")
 
 ; Fetch our datastore
 (cond ((get-environment-variable "IDENTSO_DATASTORE")