aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
Diffstat (limited to 'doc')
-rw-r--r--doc/lispref/text.texi45
1 files changed, 30 insertions, 15 deletions
diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi
index 2c5b5a1b42e..5b94580827f 100644
--- a/doc/lispref/text.texi
+++ b/doc/lispref/text.texi
@@ -5008,9 +5008,10 @@ Specifically:
5008@itemize 5008@itemize
5009 5009
5010@item 5010@item
5011JSON has a couple of keywords: @code{null}, @code{false}, and 5011JSON uses three keywords: @code{true}, @code{null}, @code{false}.
5012@code{true}. These are represented in Lisp using the keywords 5012@code{true} is represented by the symbol @code{t}. By default, the
5013@code{:null}, @code{:false}, and @code{t}, respectively. 5013remaining two are represented, respectively, by the symbols
5014@code{:null} and @code{:false}.
5014 5015
5015@item 5016@item
5016JSON only has floating-point numbers. They can represent both Lisp 5017JSON only has floating-point numbers. They can represent both Lisp
@@ -5062,14 +5063,6 @@ JSON. The subobjects within these top-level values can be of any
5062type. Likewise, the parsing functions will only return vectors, 5063type. Likewise, the parsing functions will only return vectors,
5063hashtables, alists, and plists. 5064hashtables, alists, and plists.
5064 5065
5065 The parsing functions accept keyword arguments. Currently only one
5066keyword argument, @code{:object-type}, is recognized; its value
5067decides which Lisp object to use for representing the key-value
5068mappings of a JSON object. It can be either @code{hash-table}, the
5069default, to make hashtables with strings as keys, @code{alist} to use
5070alists with symbols as keys or @code{plist} to use plists with keyword
5071symbols as keys.
5072
5073@defun json-serialize object 5066@defun json-serialize object
5074This function returns a new Lisp string which contains the JSON 5067This function returns a new Lisp string which contains the JSON
5075representation of @var{object}. 5068representation of @var{object}.
@@ -5080,16 +5073,38 @@ This function inserts the JSON representation of @var{object} into the
5080current buffer before point. 5073current buffer before point.
5081@end defun 5074@end defun
5082 5075
5083@defun json-parse-string string &key (object-type @code{hash-table}) 5076@defun json-parse-string string &rest args
5084This function parses the JSON value in @var{string}, which must be a 5077This function parses the JSON value in @var{string}, which must be a
5085Lisp string. 5078Lisp string. The argument @var{args} is a list of keyword/argument
5079pairs. The following keywords are accepted:
5080
5081@itemize
5082
5083@item @code{:object-type}
5084The value decides which Lisp object to use for representing the
5085key-value mappings of a JSON object. It can be either
5086@code{hash-table}, the default, to make hashtables with strings as
5087keys; @code{alist} to use alists with symbols as keys; or @code{plist}
5088to use plists with keyword symbols as keys.
5089
5090@item @code{:null-object}
5091The value decides which Lisp object to use to represent the JSON
5092keyword @code{null}. It defaults to the lisp symbol @code{:null}.
5093
5094@item @code{:false-object}
5095The value decides which Lisp object to use to represent the JSON
5096keyword @code{false}. It defaults to the lisp symbol @code{:false}.
5097
5098@end itemize
5099
5086@end defun 5100@end defun
5087 5101
5088@defun json-parse-buffer &key (object-type @code{hash-table}) 5102@defun json-parse-buffer &rest args
5089This function reads the next JSON value from the current buffer, 5103This function reads the next JSON value from the current buffer,
5090starting at point. It moves point to the position immediately after 5104starting at point. It moves point to the position immediately after
5091the value if a value could be read and converted to Lisp; otherwise it 5105the value if a value could be read and converted to Lisp; otherwise it
5092doesn't move point. 5106doesn't move point. @var{args} is interpreted as in
5107@code{json-parse-string}.
5093@end defun 5108@end defun
5094 5109
5095 5110