Function: json-parse-buffer

json-parse-buffer is a function defined in json.c.

Signature

(json-parse-buffer &rest args)

Documentation

Read a JSON value from current buffer starting at point.

Move point after the end of the value if parsing was successful. On error, don't move point.

The returned value will be a vector, list, hashtable, alist, or plist. Its elements will be the JSON null value, the JSON false value, t, numbers, strings, or further vectors, lists, hashtables, alists, or plists.

If the current buffer doesn't contain a valid JSON value, the function signals an error of type json-parse-error.

The arguments ARGS are a list of keyword/argument pairs:

:object-type TYPE -- use TYPE to represent JSON objects.
  TYPE can be hash-table (the default), alist or plist.
  If an object has members with the same key, hash-table keeps only
  the last value of such keys, while alist and plist keep all the
  members.

:array-type TYPE -- use TYPE to represent JSON arrays.
  TYPE can be array (the default) or list.

:null-object OBJ -- use OBJ to represent a JSON null value.
  It defaults to :null.

:false-object OBJ -- use OBJ to represent a JSON false value.
  It defaults to :false.

View in manual

Probably introduced at or before Emacs version 27.1.

Source Code

// Defined in /usr/src/emacs/src/json.c
(ptrdiff_t nargs, Lisp_Object *args)