[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] scratch/allow-custom-null-and-false-objects-in-jsonc 4aed7
From: |
Jo�o T�vora |
Subject: |
[Emacs-diffs] scratch/allow-custom-null-and-false-objects-in-jsonc 4aed7ee 1/2: After Eli's doc review |
Date: |
Sat, 9 Jun 2018 10:49:34 -0400 (EDT) |
branch: scratch/allow-custom-null-and-false-objects-in-jsonc
commit 4aed7ee79cbea9963a84d5d925d39f7bc07aed98
Author: João Távora <address@hidden>
Commit: João Távora <address@hidden>
After Eli's doc review
---
doc/lispref/text.texi | 53 ++++++++++++++++++++++++++-------------------------
src/json.c | 15 ++++++++-------
2 files changed, 35 insertions(+), 33 deletions(-)
diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi
index cfacb00..bb6ab04 100644
--- a/doc/lispref/text.texi
+++ b/doc/lispref/text.texi
@@ -5065,21 +5065,22 @@ 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:
address@hidden
address@hidden @code
address@hidden @code{:null-object}
-The value decides which Lisp object use to represent the JSON keyword
address@hidden It defaults to the lisp symbol @code{:null}.
address@hidden :null-object
+The value decides which Lisp object to use to represent the JSON
+keyword @code{null}. It defaults to the symbol @code{:null}.
address@hidden @code{:false-object}
-The value decides which Lisp object use to represent the JSON keyword
address@hidden It defaults to the lisp symbol @code{:false}.
address@hidden defun
address@hidden :false-object
+The value decides which Lisp object to use to represent the JSON
+keyword @code{false}. It defaults to the symbol @code{:false}.
address@hidden itemize
address@hidden table
+
address@hidden defun
@defun json-insert object &rest args
This function inserts the JSON representation of @var{object} into the
@@ -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:
address@hidden
address@hidden @code
address@hidden @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.
address@hidden :object-type
+The value decides which Lisp object to use for representing the
+key-value mappings of a JSON object. It can be either
address@hidden, 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.
address@hidden @code{:null-object}
-The value decides which Lisp object use to represent the JSON keyword
address@hidden It defaults to the lisp symbol @code{:null}.
address@hidden :null-object
+The value decides which Lisp object to use to represent the JSON
+keyword @code{null}. It defaults to the symbol @code{:null}.
address@hidden @code{:false-object}
-The value decides which Lisp object use to represent the JSON keyword
address@hidden It defaults to the lisp symbol @code{:false}.
address@hidden :false-object
+The value decides which Lisp object to use to represent the JSON
+keyword @code{false}. It defaults to the symbol @code{:false}.
address@hidden itemize
address@hidden table
@end defun
diff --git a/src/json.c b/src/json.c
index fc4bc1f..cd749e3 100644
--- a/src/json.c
+++ b/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 ();