mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-17 10:27:41 +00:00
After Eli's doc review
This commit is contained in:
parent
3a8286696b
commit
4aed7ee79c
2 changed files with 35 additions and 33 deletions
|
|
@ -5065,22 +5065,23 @@ hashtables, alists, and plists.
|
|||
|
||||
@defun json-serialize object &rest args
|
||||
This function returns a new Lisp string which contains the JSON
|
||||
representation of @var{object}. The arguments @var{args} are a list
|
||||
of keyword/argument pairs. The following keywords are accepted:
|
||||
representation of @var{object}. The argument @var{args} is a list of
|
||||
keyword/argument pairs. The following keywords are accepted:
|
||||
|
||||
@itemize
|
||||
@table @code
|
||||
|
||||
@item @code{:null-object}
|
||||
The value decides which Lisp object use to represent the JSON keyword
|
||||
@code{null}. It defaults to the lisp symbol @code{:null}.
|
||||
@item :null-object
|
||||
The value decides which Lisp object to use to represent the JSON
|
||||
keyword @code{null}. It defaults to the symbol @code{:null}.
|
||||
|
||||
@item :false-object
|
||||
The value decides which Lisp object to use to represent the JSON
|
||||
keyword @code{false}. It defaults to the symbol @code{:false}.
|
||||
|
||||
@end table
|
||||
|
||||
@item @code{:false-object}
|
||||
The value decides which Lisp object use to represent the JSON keyword
|
||||
@code{false}. It defaults to the lisp symbol @code{:false}.
|
||||
@end defun
|
||||
|
||||
@end itemize
|
||||
|
||||
@defun json-insert object &rest args
|
||||
This function inserts the JSON representation of @var{object} into the
|
||||
current buffer before point. @var{args} is interpreted as in
|
||||
|
|
@ -5089,27 +5090,27 @@ current buffer before point. @var{args} is interpreted as in
|
|||
|
||||
@defun json-parse-string string &rest args
|
||||
This function parses the JSON value in @var{string}, which must be a
|
||||
Lisp string. The arguments @var{args} are a list of keyword/argument
|
||||
Lisp string. The argument @var{args} is a list of keyword/argument
|
||||
pairs. The following keywords are accepted:
|
||||
|
||||
@itemize
|
||||
@table @code
|
||||
|
||||
@item @code{:object-type}
|
||||
The value decides which Lisp object to use for representing the key-value
|
||||
mappings of a JSON object. It can be either @code{hash-table}, the
|
||||
default, to make hashtables with strings as keys, @code{alist} to use
|
||||
alists with symbols as keys or @code{plist} to use plists with keyword
|
||||
symbols as keys.
|
||||
@item :object-type
|
||||
The value decides which Lisp object to use for representing the
|
||||
key-value mappings of a JSON object. It can be either
|
||||
@code{hash-table}, the default, to make hashtables with strings as
|
||||
keys; @code{alist} to use alists with symbols as keys; or @code{plist}
|
||||
to use plists with keyword symbols as keys.
|
||||
|
||||
@item @code{:null-object}
|
||||
The value decides which Lisp object use to represent the JSON keyword
|
||||
@code{null}. It defaults to the lisp symbol @code{:null}.
|
||||
@item :null-object
|
||||
The value decides which Lisp object to use to represent the JSON
|
||||
keyword @code{null}. It defaults to the symbol @code{:null}.
|
||||
|
||||
@item @code{:false-object}
|
||||
The value decides which Lisp object use to represent the JSON keyword
|
||||
@code{false}. It defaults to the lisp symbol @code{:false}.
|
||||
@item :false-object
|
||||
The value decides which Lisp object to use to represent the JSON
|
||||
keyword @code{false}. It defaults to the symbol @code{:false}.
|
||||
|
||||
@end itemize
|
||||
@end table
|
||||
|
||||
@end defun
|
||||
|
||||
|
|
|
|||
15
src/json.c
15
src/json.c
|
|
@ -557,7 +557,7 @@ DEFUN ("json-serialize", Fjson_serialize, Sjson_serialize, 1, MANY,
|
|||
doc: /* Return the JSON representation of OBJECT as a string.
|
||||
|
||||
OBJECT must be a vector, hashtable, alist, or plist and its elements
|
||||
can recursively contain the lisp equivalents to the JSON null and
|
||||
can recursively contain the Lisp equivalents to the JSON null and
|
||||
false values, t, numbers, strings, or other vectors hashtables, alists
|
||||
or plists. t will be converted to the JSON true value. Vectors will
|
||||
be converted to JSON arrays, whereas hashtables, alists and plists are
|
||||
|
|
@ -566,7 +566,7 @@ embedded null characters and must be unique within each object. Alist
|
|||
and plist keys must be symbols; if a key is duplicate, the first
|
||||
instance is used.
|
||||
|
||||
The lisp equivalents to the JSON null and false values are
|
||||
The Lisp equivalents to the JSON null and false values are
|
||||
configurable in the arguments ARGS, a list of keyword/argument pairs:
|
||||
|
||||
The keyword argument `:null-object' specifies which object to use
|
||||
|
|
@ -575,10 +575,10 @@ to represent a JSON null value. It defaults to `:null'.
|
|||
The keyword argument `:false-object' specifies which object to use to
|
||||
represent a JSON false value. It defaults to `:false'.
|
||||
|
||||
Note that ambiguity can arise if you specify the same value for
|
||||
`:null-object' and `:false-object', and so this function's behaviour
|
||||
is unspecified
|
||||
*/)
|
||||
In you specify the same value for `:null-object' and `:false-object',
|
||||
a potentially ambiguous situation, the JSON output will not contain
|
||||
any JSON false values.
|
||||
usage: (json-serialize STRING &rest ARGS) */)
|
||||
(ptrdiff_t nargs, Lisp_Object *args)
|
||||
{
|
||||
ptrdiff_t count = SPECPDL_INDEX ();
|
||||
|
|
@ -843,7 +843,8 @@ The keyword argument `:null-object' specifies which object to use
|
|||
to represent a JSON null value. It defaults to `:null'.
|
||||
|
||||
The keyword argument `:false-object' specifies which object to use to
|
||||
represent a JSON false value. It defaults to `:false'. */)
|
||||
represent a JSON false value. It defaults to `:false'.
|
||||
usage: (json-parse-string STRING &rest ARGS) */)
|
||||
(ptrdiff_t nargs, Lisp_Object *args)
|
||||
{
|
||||
ptrdiff_t count = SPECPDL_INDEX ();
|
||||
|
|
|
|||
Loading…
Reference in a new issue