summaryrefslogtreecommitdiff
path: root/lib/zambyte/meta/gerbil.scm
blob: 00f7b0ef837a28ab80b06c42c8324d2c0d1fd001 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
(import (std text json)
	(scheme hash-table))
(begin
  (define string->json string->json-object)
  (define json->string json-object->string)

  (define (json-object . pairs)
    (alist->hash-table pairs equal?))

  (define json-list list)
  (define json-null #!void)
  (define json-object? hash-table?)
  (define json-list? list?)

  (define (json-null? obj)
    (eq? obj json-null))

  (define (json-object-ref json key)
    (hash-table-ref json (string->symbol key)))

  (define json-list-ref list-ref)
  (define json-object->alist hash-table->alist)
  (define json-list->list values))