diff options
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/lispref/text.texi | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi index 5b288d9750e..9592702ef1c 100644 --- a/doc/lispref/text.texi +++ b/doc/lispref/text.texi | |||
| @@ -4965,14 +4965,13 @@ represented using Lisp vectors. | |||
| 4965 | 4965 | ||
| 4966 | @item | 4966 | @item |
| 4967 | JSON has only one map type, the object. JSON objects are represented | 4967 | JSON has only one map type, the object. JSON objects are represented |
| 4968 | using Lisp hashtables. | 4968 | using Lisp hashtables or alists. |
| 4969 | 4969 | ||
| 4970 | @end itemize | 4970 | @end itemize |
| 4971 | 4971 | ||
| 4972 | @noindent | 4972 | @noindent |
| 4973 | Note that @code{nil} doesn't represent any JSON values: this is to | 4973 | Note that @code{nil} represents the empty JSON object, @code{@{@}}, |
| 4974 | avoid confusion, because @code{nil} could either represent | 4974 | not @code{null}, @code{false}, or an empty array, all of which are |
| 4975 | @code{null}, @code{false}, or an empty array, all of which are | ||
| 4976 | different JSON values. | 4975 | different JSON values. |
| 4977 | 4976 | ||
| 4978 | If some Lisp object can't be represented in JSON, the serialization | 4977 | If some Lisp object can't be represented in JSON, the serialization |
| @@ -4995,8 +4994,13 @@ The parsing functions will signal the following errors: | |||
| 4995 | 4994 | ||
| 4996 | Only top-level values (arrays and objects) can be serialized to | 4995 | Only top-level values (arrays and objects) can be serialized to |
| 4997 | JSON. The subobjects within these top-level values can be of any | 4996 | JSON. The subobjects within these top-level values can be of any |
| 4998 | type. Likewise, the parsing functions will only return vectors and | 4997 | type. Likewise, the parsing functions will only return vectors, |
| 4999 | hashtables. | 4998 | hashtables, and alists. |
| 4999 | |||
| 5000 | The parsing functions accept keyword arguments. Currently only one | ||
| 5001 | keyword argument, @code{:object-type}, is recognized; its value can be | ||
| 5002 | either @code{hash-table} to parse JSON objects as hashtables with | ||
| 5003 | string keys (the default) or @code{alist} to parse them as alists. | ||
| 5000 | 5004 | ||
| 5001 | @defun json-serialize object | 5005 | @defun json-serialize object |
| 5002 | This function returns a new Lisp string which contains the JSON | 5006 | This function returns a new Lisp string which contains the JSON |
| @@ -5008,12 +5012,12 @@ This function inserts the JSON representation of @var{object} into the | |||
| 5008 | current buffer before point. | 5012 | current buffer before point. |
| 5009 | @end defun | 5013 | @end defun |
| 5010 | 5014 | ||
| 5011 | @defun json-parse-string string | 5015 | @defun json-parse-string string &key (object-type @code{hash-table}) |
| 5012 | This function parses the JSON value in @var{string}, which must be a | 5016 | This function parses the JSON value in @var{string}, which must be a |
| 5013 | Lisp string. | 5017 | Lisp string. |
| 5014 | @end defun | 5018 | @end defun |
| 5015 | 5019 | ||
| 5016 | @defun json-parse-buffer | 5020 | @defun json-parse-buffer &key (object-type @code{hash-table}) |
| 5017 | This function reads the next JSON value from the current buffer, | 5021 | This function reads the next JSON value from the current buffer, |
| 5018 | starting at point. It moves point to the position immediately after | 5022 | starting at point. It moves point to the position immediately after |
| 5019 | the value if a value could be read and converted to Lisp; otherwise it | 5023 | the value if a value could be read and converted to Lisp; otherwise it |