aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2019-04-13 10:07:15 +0300
committerEli Zaretskii2019-04-13 10:07:15 +0300
commit2475687d2f0ca6a605d091bb7acb723d0dace27b (patch)
tree977ae5a872959d149f09e759a20a0a5370ce1379
parent7ddd08bd3ebc48998062a7d29274cf080256a48f (diff)
downloademacs-2475687d2f0ca6a605d091bb7acb723d0dace27b.tar.gz
emacs-2475687d2f0ca6a605d091bb7acb723d0dace27b.zip
Improve documentation changes of a recent commit
* doc/lispref/text.texi (Parsing JSON): Improve wording of the documentation of 'json-parse-string' and 'json-parse-buffer'. * src/json.c (Fjson_parse_string, Fjson_parse_buffer): Doc fix. (Bug#34763)
-rw-r--r--doc/lispref/text.texi13
-rw-r--r--src/json.c42
2 files changed, 40 insertions, 15 deletions
diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi
index b46ee647862..e8de8177e30 100644
--- a/doc/lispref/text.texi
+++ b/doc/lispref/text.texi
@@ -5156,8 +5156,11 @@ as in @code{json-parse-string}.
5156 5156
5157@defun json-parse-string string &rest args 5157@defun json-parse-string string &rest args
5158This function parses the JSON value in @var{string}, which must be a 5158This function parses the JSON value in @var{string}, which must be a
5159Lisp string. The argument @var{args} is a list of keyword/argument 5159Lisp string. If @var{string} doesn't contain a valid JSON object,
5160pairs. The following keywords are accepted: 5160this function signals the @code{json-parse-error} error.
5161
5162The argument @var{args} is a list of keyword/argument pairs. The
5163following keywords are accepted:
5161 5164
5162@table @code 5165@table @code
5163@item :object-type 5166@item :object-type
@@ -5186,9 +5189,9 @@ keyword @code{false}. It defaults to the symbol @code{:false}.
5186@defun json-parse-buffer &rest args 5189@defun json-parse-buffer &rest args
5187This function reads the next JSON value from the current buffer, 5190This function reads the next JSON value from the current buffer,
5188starting at point. It moves point to the position immediately after 5191starting at point. It moves point to the position immediately after
5189the value if a value could be read and converted to Lisp; otherwise it 5192the value if contains a valid JSON object; otherwise it signals the
5190doesn't move point. The arguments @var{args} are interpreted as in 5193@code{json-parse-error} error and doesn't move point. The arguments
5191@code{json-parse-string}. 5194@var{args} are interpreted as in @code{json-parse-string}.
5192@end defun 5195@end defun
5193 5196
5194@node JSONRPC 5197@node JSONRPC
diff --git a/src/json.c b/src/json.c
index eb323b498c7..74e0534065f 100644
--- a/src/json.c
+++ b/src/json.c
@@ -948,23 +948,22 @@ json_to_lisp (json_t *json, struct json_configuration *conf)
948DEFUN ("json-parse-string", Fjson_parse_string, Sjson_parse_string, 1, MANY, 948DEFUN ("json-parse-string", Fjson_parse_string, Sjson_parse_string, 1, MANY,
949 NULL, 949 NULL,
950 doc: /* Parse the JSON STRING into a Lisp object. 950 doc: /* Parse the JSON STRING into a Lisp object.
951
952This is essentially the reverse operation of `json-serialize', which 951This is essentially the reverse operation of `json-serialize', which
953see. The returned object will be a vector, hashtable, alist, or 952see. The returned object will be a vector, list, hashtable, alist, or
954plist. Its elements will be the JSON null value, the JSON false 953plist. Its elements will be the JSON null value, the JSON false
955value, t, numbers, strings, or further vectors, hashtables, alists, or 954value, t, numbers, strings, or further vectors, hashtables, alists, or
956plists. If there are duplicate keys in an object, all but the last 955plists. If there are duplicate keys in an object, all but the last
957one are ignored. If STRING doesn't contain a valid JSON object, an 956one are ignored. If STRING doesn't contain a valid JSON object, this
958error of type `json-parse-error' is signaled. The arguments ARGS are 957function signals an error of type `json-parse-error'.
959a list of keyword/argument pairs: 958
959The arguments ARGS are a list of keyword/argument pairs:
960 960
961The keyword argument `:object-type' specifies which Lisp type is used 961The keyword argument `:object-type' specifies which Lisp type is used
962to represent objects; it can be `hash-table', `alist' or `plist'. It 962to represent objects; it can be `hash-table', `alist' or `plist'. It
963defaults to `hash-table'. 963defaults to `hash-table'.
964 964
965The keyword argument `:array-type' specifies which Lisp type is used 965The keyword argument `:array-type' specifies which Lisp type is used
966to represent arrays; it can be `array' or `list'. It defaults to 966to represent arrays; it can be `array' (the default) or `list'.
967`array'.
968 967
969The keyword argument `:null-object' specifies which object to use 968The keyword argument `:null-object' specifies which object to use
970to represent a JSON null value. It defaults to `:null'. 969to represent a JSON null value. It defaults to `:null'.
@@ -1042,9 +1041,32 @@ json_read_buffer_callback (void *buffer, size_t buflen, void *data)
1042DEFUN ("json-parse-buffer", Fjson_parse_buffer, Sjson_parse_buffer, 1041DEFUN ("json-parse-buffer", Fjson_parse_buffer, Sjson_parse_buffer,
1043 0, MANY, NULL, 1042 0, MANY, NULL,
1044 doc: /* Read JSON object from current buffer starting at point. 1043 doc: /* Read JSON object from current buffer starting at point.
1045This is similar to `json-parse-string', which see. Move point after 1044Move point after the end of the object if parsing was successful.
1046the end of the object if parsing was successful. On error, point is 1045On error, don't move point.
1047not moved. 1046
1047The returned object will be a vector, list, hashtable, alist, or
1048plist. Its elements will be the JSON null value, the JSON false
1049value, t, numbers, strings, or further vectors, lists, hashtables,
1050alists, or plists. If there are duplicate keys in an object, all
1051but the last one are ignored.
1052
1053If the current buffer doesn't contain a valid JSON object, the
1054function signals an error of type `json-parse-error'.
1055
1056The arguments ARGS are a list of keyword/argument pairs:
1057
1058The keyword argument `:object-type' specifies which Lisp type is used
1059to represent objects; it can be `hash-table', `alist' or `plist'. It
1060defaults to `hash-table'.
1061
1062The keyword argument `:array-type' specifies which Lisp type is used
1063to represent arrays; it can be `array' (the default) or `list'.
1064
1065The keyword argument `:null-object' specifies which object to use
1066to represent a JSON null value. It defaults to `:null'.
1067
1068The keyword argument `:false-object' specifies which object to use to
1069represent a JSON false value. It defaults to `:false'.
1048usage: (json-parse-buffer &rest args) */) 1070usage: (json-parse-buffer &rest args) */)
1049 (ptrdiff_t nargs, Lisp_Object *args) 1071 (ptrdiff_t nargs, Lisp_Object *args)
1050{ 1072{