Function: json-parse-string

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

Signature

(json-parse-string STRING &rest ARGS)

Documentation

Parse the JSON STRING into a Lisp value.

This is essentially the reverse operation of json-serialize, which see. The returned value will be the JSON null value, the JSON false value, t, a number, a string, a vector, a list, a hash-table, an alist, or a plist. Its elements will be further values of these types. If STRING doesn't contain a valid JSON value, this 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)