From e0f7c49823bcb3c569f7334355e4fac8ba7061f7 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 16 Jun 2018 13:49:36 +0300 Subject: [PATCH] * doc/lispref/text.texi (Parsing JSON): Minor formatting changes. --- doc/lispref/text.texi | 37 +++++++++++++++---------------------- 1 file changed, 15 insertions(+), 22 deletions(-) diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi index ea9c82422ec..94cd87acf71 100644 --- a/doc/lispref/text.texi +++ b/doc/lispref/text.texi @@ -5016,14 +5016,14 @@ textual nodes that just contain white-space. @node Parsing JSON @section Parsing and generating JSON values @cindex JSON +@cindex JavaScript Object Notation - When Emacs is compiled with JSON support, it provides a couple of -functions to convert between Lisp objects and JSON values. Any JSON -value can be converted to a Lisp object, but not vice versa. -Specifically: + When Emacs is compiled with @acronym{JSON} (@dfn{JavaScript Object +Notation}) support, it provides several functions to convert +between Lisp objects and JSON values. Any JSON value can be converted +to a Lisp object, but not vice versa. Specifically: @itemize - @item JSON uses three keywords: @code{true}, @code{null}, @code{false}. @code{true} is represented by the symbol @code{t}. By default, the @@ -5035,8 +5035,8 @@ JSON only has floating-point numbers. They can represent both Lisp integers and Lisp floating-point numbers. @item -JSON strings are always Unicode strings. Lisp strings can contain -non-Unicode characters. +JSON strings are always Unicode strings encoded in UTF-8. Lisp +strings can contain non-Unicode characters. @item JSON has only one sequence type, the array. JSON arrays are @@ -5048,7 +5048,6 @@ using Lisp hashtables, alists or plists. When an alist or plist contains several elements with the same key, Emacs uses only the first element for serialization, in accordance with the behavior of @code{assq}. - @end itemize @noindent @@ -5059,20 +5058,18 @@ values. If some Lisp object can't be represented in JSON, the serialization functions will signal an error of type @code{wrong-type-argument}. -The parsing functions will signal the following errors: +The parsing functions can also signal the following errors: @table @code - @item json-end-of-file - Signaled when encountering a premature end of the input text. +Signaled when encountering a premature end of the input text. @item json-trailing-content - Signaled when encountering unexpected input after the first JSON - object parsed. +Signaled when encountering unexpected input after the first JSON +object parsed. @item json-parse-error - Signaled when encountering invalid JSON syntax. - +Signaled when encountering invalid JSON syntax. @end table Only top-level values (arrays and objects) can be serialized to @@ -5086,7 +5083,6 @@ representation of @var{object}. The argument @var{args} is a list of keyword/argument pairs. The following keywords are accepted: @table @code - @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}. @@ -5094,15 +5090,14 @@ 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 @end defun @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 -@code{json-parse-string}. +current buffer before point. The argument @var{args} are interpreted +as in @code{json-parse-string}. @end defun @defun json-parse-string string &rest args @@ -5111,7 +5106,6 @@ Lisp string. The argument @var{args} is a list of keyword/argument pairs. The following keywords are accepted: @table @code - @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 @@ -5126,7 +5120,6 @@ 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 @end defun @@ -5135,7 +5128,7 @@ keyword @code{false}. It defaults to the symbol @code{:false}. This function reads the next JSON value from the current buffer, starting at point. It moves point to the position immediately after the value if a value could be read and converted to Lisp; otherwise it -doesn't move point. @var{args} is interpreted as in +doesn't move point. The arguments @var{args} are interpreted as in @code{json-parse-string}. @end defun -- 2.39.2