summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobby Zambito <contact@robbyzambito.me>2023-02-14 20:53:06 -0500
committerRobby Zambito <contact@robbyzambito.me>2023-02-14 20:53:06 -0500
commit0a792043c71a7ed457a2dd65930c5c75d1976783 (patch)
tree53ffd426a4db6ae54259bf1fcd9eb6398acb3d5c
parent0b17e637d3791d1ca94558429f9deba3a5876166 (diff)
Update README to reflect previous change to the API
-rw-r--r--README.org24
1 files changed, 12 insertions, 12 deletions
diff --git a/README.org b/README.org
index 5e2b95e..d61b0e8 100644
--- a/README.org
+++ b/README.org
@@ -17,7 +17,7 @@ This library aims to be an implementation of the latter which you can just plug
~(json-object pairs ...)~:
Constructs a new JSON object.
-~pairs~ are ~pair?~ objects with a ~string?~ as the ~car~, and a ~json-value?~ as the ~cdr~.
+~pairs~ are ~pair?~ objects with a ~symbol?~ as the ~car~, and a ~json-value?~ as the ~cdr~.
An alist can be converted to a JSON object like so: ~(apply json-object alist)~
@@ -66,7 +66,7 @@ Converts a ~string?~ into a ~json-value?~
~(json-object-ref obj key)~:
Returns the ~json-value?~ associated with ~key~ in ~obj~.
-~key~ should be a ~string?~.
+~key~ should be a ~symbol?~.
The behavior when ~key~ is not found in ~obj~ can be controlled with the ~json-key-not-found~ parameter.
The value of ~json-key-not-found~ should be a procedure of no arguments, and the return value of the procedure is returned, if any exists.
@@ -86,7 +86,7 @@ General JSON reference accessor.
If ~json~ is a ~json-list?~ and ~ref~ is a ~number?~, get the element at that index of the list.
-If ~json~ is a ~json-object?~ and ~ref~ is a ~string?~, get the value associated with that key in the object.
+If ~json~ is a ~json-object?~ and ~ref~ is a ~symbol?~, get the value associated with that key in the object.
If there are more ~refs ...~, they are recursively applied.
@@ -94,7 +94,7 @@ If there are more ~refs ...~, they are recursively applied.
** Conversion
~(json-object->alist obj)~:
-Convert ~obj~ to a ~list?~ of ~pair?~ where the ~car~ of each pair is a ~string?~ and the ~cdr~ is the associated ~json-value?~.
+Convert ~obj~ to a ~list?~ of ~pair?~ where the ~car~ of each pair is a ~symbol?~ and the ~cdr~ is the associated ~json-value?~.
~(json-list->list lst)~:
@@ -115,20 +115,20 @@ Convert ~lst~ to a ~list?~ of ~json-value?~.
#+begin_src scheme
(json-object-contains-key?
- (json-object '("a" . 5)
- `("b" . ,(json-list 1 2 3)))
- "a") ; => #t
+ (json-object '(a . 5)
+ `(b . ,(json-list 1 2 3)))
+ 'a) ; => #t
(json-object-contains-key?
- (json-object '("a" . 5)
- `("b" . ,(json-list 1 2 3)))
- "c") ; => #f
+ (json-object '(a . 5)
+ `(b . ,(json-list 1 2 3)))
+ 'c) ; => #f
#+end_src
#+begin_src scheme
(json-ref
- (json-object `("x" . ,(json-list "hello" "world")))
- "x"
+ (json-object `(x . ,(json-list "hello" "world")))
+ 'x
0) ; => "hello"
#+end_src