Skip to content

Commit

Permalink
Update docs for the new :array-as key
Browse files Browse the repository at this point in the history
  • Loading branch information
libre-man committed Jun 3, 2017
1 parent ba13fa6 commit 5808f18
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,16 @@ This HTML is generated by [Codex](https://github.com/CommonDoc/codex).
(parse "{\"NAME\":\"Common Lisp\",\"BORN\":1984,\"IMPLS\":[\"SBCL\",\"KCL\"]}"
:as :hash-table)
;; => #<HASH-TABLE :TEST EQUAL :COUNT 3>
(parse "[1, 2, 3]")
;; => (1 2 3)
(parse "[1, 2, 3]"
:array-as 'vector)
;; => #(1 2 3)
```

## Installasion
## Installation

```Lisp
(ql:quickload :jonathan)
Expand Down Expand Up @@ -150,6 +157,9 @@ This HTML is generated by [Codex](https://github.com/CommonDoc/codex).
- Association List. (`:as :alist`)
- Json Object. (`:as :jsown`)
- Hash Table. (`:as :hash-table`)
- can decode JSON arrays to any sequence, specify by `:array-as` can be anything
a vector can be coerced to. There are special (faster) cases for vectors and
lists.
- can allow junked JSON format string (`:junk-allowed t`)
- can customize `*null-value*`, `*false-value*` and `*empty-array-value*`.
- can restrict keywords to read. (`:keywords-to-read`)
Expand Down Expand Up @@ -177,6 +187,15 @@ This HTML is generated by [Codex](https://github.com/CommonDoc/codex).
(parse "{\"key1\":\"value1\",\"key2\":\"value2\"}" :keywords-to-read '("key1"))
;; => (:|key1| "value1")
(parse "[1, 2, 3]") ;; Same as (parse "[1, 2, 3]" :array-as 'list)
;; => (1 2 3)
(parse "[1, 2, 3]" :array-as 'vector)
;; => #(1 2 3)
(parse "[1, 2, 3]" :array-as 'my-sequence) ;; Only on supporting implementations
;; => #<My sequence>
(flet ((normalizer (key)
(with-vector-parsing (key)
(match-i-case
Expand Down

0 comments on commit 5808f18

Please sign in to comment.