Skip to content

Commit

Permalink
Document inline file/index behavior.
Browse files Browse the repository at this point in the history
  • Loading branch information
aartaka committed Feb 2, 2024
1 parent 3dac8f7 commit 3187032
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ entry under key is found (like in ~gethash~).
(njson:jget #p"/second-key/0" data)
;; => 1, T

;; Can decode and index files as an alias for `njson:decode'.
(njson:jget #(0 "kind") #p"tests/baker.json")
;; "Listing"

;; Modify the element in place:
(setf (njson:jget #p"/second-key/0" data) 3)
;; Another indexing syntax, for no particular reason:
Expand Down
7 changes: 7 additions & 0 deletions functions.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,13 @@ KEY-OR-INDEX can be
- a sequence of integers and strings (to index the nested structures).
- an empty sequence/pathname (to match the whole object).
OBJECT can be
- A hash table, indexed by strings
- An array, indexed by integers
- A stream, which is `decode'd and then indexed
- A pathname, which is `decode'd and then indexed
- Anything else, considered an error (see below)
Return two values: the value under KEY-OR-INDEX and whether this value
was found.
Expand Down

0 comments on commit 3187032

Please sign in to comment.