AtlatestRenderedmarkdown
sigil-json / treeREADME.md
Readme
sigil-json
JSON parsing and generation for Sigil.
Bidirectional conversion between JSON and native Scheme types (dicts, arrays, strings, numbers, booleans) with port-based I/O for reading and writing JSON streams.
This package was extracted from the sigil monorepo — the in-tree history under packages/sigil-json/ is preserved here as master.
Usage
(import (sigil json))
;; Encode
(json-encode #{ name: "Alice" age: 30 })
; => "{\"name\":\"Alice\",\"age\":30}"
;; Decode
(json-decode "{\"name\":\"Alice\",\"age\":30}")
; => #{ name: "Alice" age: 30 }
;; Path lookup
(json-get-in (json-decode "{\"a\":{\"b\":42}}") '(a b))
; => 42Type Mapping
| JSON | Scheme |
|---|---|
| object | dict: #{ name: "Alice" } |
| array | array: #[1 2 3] |
| string | string: "hello" |
| number | number: 42, 3.14 |
| true | #t |
| false | #f |
| null | 'null symbol |
JSON null decodes as the symbol 'null (not #f). When a field may be JSON null, normalize it explicitly — see docs/json.md for the pattern.
API
(sigil json)
| Procedure | Purpose |
|---|---|
json-encode | Scheme value → JSON string |
json-decode | JSON string → Scheme value |
json-read / json-write | Port-based streaming I/O |
json-get-in | Path lookup into a decoded value |
See docs/json.md for full details.
Dependencies
sigil-stdlib
Consumed here as a from-git ref pinned to ^0.13.1 against the sigil monorepo.
Build
sigil deps install
sigil buildTesting
sigil testLicense
BSD-3-Clause.