This is the cl-json Reference Manual, version 0.6.0, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Dec 15 05:03:42 2024 GMT+0.
The main system appears first, followed by any subsystem dependency.
cl-json
JSON in Lisp. JSON (JavaScript Object Notation) is a lightweight data-interchange format.
Robert P. Goldman <rpgoldman@sift.net>
Henrik Hjelte <henrik@henrikhjelte.com>
MIT
0.6.0
src
(module).
Modules are listed depth-first from the system components tree.
cl-json/src
cl-json
(system).
package.lisp
(file).
common.lisp
(file).
objects.lisp
(file).
camel-case.lisp
(file).
decoder.lisp
(file).
encoder.lisp
(file).
utils.lisp
(file).
json-rpc.lisp
(file).
Files are sorted by type and then listed depth-first from the systems components trees.
cl-json/cl-json.asd
cl-json/src/package.lisp
cl-json/src/common.lisp
cl-json/src/objects.lisp
cl-json/src/camel-case.lisp
cl-json/src/decoder.lisp
cl-json/src/encoder.lisp
cl-json/src/utils.lisp
cl-json/src/json-rpc.lisp
cl-json/cl-json.asd
cl-json
(system).
*cl-json-directory*
(special variable).
cl-json/src/common.lisp
package.lisp
(file).
src
(module).
*identifier-name-to-key*
(special variable).
*json-identifier-name-to-lisp*
(special variable).
*json-symbols-package*
(special variable).
*lisp-identifier-name-to-json*
(special variable).
*use-strict-json-rules*
(special variable).
bind-custom-vars
(macro).
json-intern
(function).
safe-json-intern
(function).
set-custom-vars
(macro).
unknown-symbol-error
(function).
unknown-symbol-error
(condition).
with-shadowed-custom-vars
(macro).
*custom-vars*
(special variable).
+json-lisp-escaped-chars+
(special variable).
+json-lisp-symbol-tokens+
(special variable).
custom-key-to-variable
(function).
define-custom-var
(macro).
let-gensyms
(macro).
loop-on-custom
(macro).
unknown-symbol-error-datum
(reader method).
(setf unknown-symbol-error-datum)
(writer method).
cl-json/src/objects.lisp
package.lisp
(file).
src
(module).
*prototype-name*
(special variable).
add-direct-subclass
(method).
clear-class-registry
(function).
compute-class-precedence-list
(method).
fluid-class
(class).
fluid-object
(class).
make-load-form
(method).
make-object
(generic function).
make-object-prototype
(generic function).
prototype
(class).
remove-direct-subclass
(method).
slot-missing
(method).
slot-missing
(method).
slot-missing
(method).
slot-missing
(method).
validate-superclass
(method).
with-local-class-registry
(macro).
*class-registry*
(special variable).
ensure-fluid-class-with-slots
(function).
find-class*
(function).
lisp-class
(reader method).
lisp-package
(reader method).
lisp-superclasses
(reader method).
make-and-populate-instance
(function).
map-slots
(function).
max-package
(function).
maybe-add-prototype
(function).
package-name*
(function).
cl-json/src/camel-case.lisp
package.lisp
(file).
src
(module).
camel-case-to-lisp
(function).
lisp-to-camel-case
(function).
simplified-camel-case-to-lisp
(function).
camel-case-split
(function).
camel-case-transform
(function).
camel-case-transform-all-caps
(function).
cl-json/src/decoder.lisp
common.lisp
(file).
objects.lisp
(file).
camel-case.lisp
(file).
src
(module).
*aggregate-scope-variables*
(special variable).
*array-member-handler*
(special variable).
*array-scope-variables*
(special variable).
*beginning-of-array-handler*
(special variable).
*beginning-of-object-handler*
(special variable).
*beginning-of-string-handler*
(special variable).
*boolean-handler*
(special variable).
*end-of-array-handler*
(special variable).
*end-of-object-handler*
(special variable).
*end-of-string-handler*
(special variable).
*integer-handler*
(special variable).
*internal-decoder*
(special variable).
*json-array-type*
(special variable).
*json-input*
(special variable).
*object-key-handler*
(special variable).
*object-scope-variables*
(special variable).
*object-value-handler*
(special variable).
*real-handler*
(special variable).
*string-char-handler*
(special variable).
*string-scope-variables*
(special variable).
current-decoder
(macro).
custom-decoder
(macro).
decode-json
(function).
decode-json-from-source
(function).
decode-json-from-string
(function).
decode-json-strict
(function).
json-syntax-error
(function).
json-syntax-error
(condition).
no-char-for-code
(condition).
set-decoder-simple-clos-semantics
(function).
set-decoder-simple-list-semantics
(function).
with-custom-decoder-level
(macro).
with-decoder-simple-clos-semantics
(macro).
with-decoder-simple-list-semantics
(macro).
*accumulator*
(special variable).
*accumulator-last*
(special variable).
*prototype*
(special variable).
*prototype-prototype*
(special variable).
accumulator-add
(function).
accumulator-add-key
(function).
accumulator-add-key-or-set-prototype
(function).
accumulator-add-value
(function).
accumulator-add-value-or-set-prototype
(function).
accumulator-get
(function).
accumulator-get-object
(function).
accumulator-get-sequence
(function).
accumulator-get-string
(function).
aggregate-scope-progv
(macro).
decode-json-array
(function).
decode-json-object
(function).
decode-json-string
(function).
escaped-char-dispatch
(macro).
init-accumulator
(function).
init-accumulator-and-prototype
(function).
init-string-stream-accumulator
(function).
json-boolean-to-lisp
(function).
offending-code
(reader method).
parse-number
(function).
peek-json-token
(function).
read-json-name-token
(function).
read-json-number-token
(function).
read-json-string-char
(function).
read-json-token
(function).
stream-error-stream-file-position
(reader method).
string-stream-accumulator-add
(function).
string-stream-accumulator-get
(function).
cl-json/src/encoder.lisp
common.lisp
(file).
objects.lisp
(file).
camel-case.lisp
(file).
src
(module).
*json-output*
(special variable).
as-array-member
(macro).
as-object-member
(macro).
encode-array-member
(function).
encode-json
(generic function).
encode-json-alist
(function).
encode-json-alist-to-string
(function).
encode-json-plist
(function).
encode-json-plist-to-string
(function).
encode-json-to-string
(function).
encode-object-member
(function).
json-bool
(function).
json-or-null
(function).
stream-array-member-encoder
(function).
stream-object-member-encoder
(function).
unencodable-value-error
(function).
unencodable-value-error
(condition).
use-explicit-encoder
(function).
use-guessing-encoder
(function).
with-array
(macro).
with-explicit-encoder
(macro).
with-guessing-encoder
(macro).
with-object
(macro).
with-substitute-printed-representation-restart
(macro).
*json-aggregate-context*
(special variable).
*json-aggregate-first*
(special variable).
*json-list-encoder-fn*
(special variable).
encode-json-list-explicit-encoder
(function).
encode-json-list-guessing-encoder
(function).
next-aggregate-member
(function).
unencodable-value-error-context
(reader method).
(setf unencodable-value-error-context)
(writer method).
with-aggregate
(macro).
with-local-encoder
(macro).
write-json-chars
(function).
write-json-number
(function).
write-json-string
(function).
cl-json/src/utils.lisp
decoder.lisp
(file).
encoder.lisp
(file).
src
(module).
json-bind
(macro).
json-bind-level-customizations
(function).
range-keys
(function).
cl-json/src/json-rpc.lisp
package.lisp
(file).
common.lisp
(file).
utils.lisp
(file).
encoder.lisp
(file).
decoder.lisp
(file).
src
(module).
*json-rpc-version*
(special variable).
+json-rpc-1.1+
(constant).
+json-rpc-2.0+
(constant).
clear-exported
(function).
def-json-rpc-encoding
(macro).
defun-json-rpc
(macro).
export-as-json-rpc
(function).
invoke-rpc
(function).
invoke-rpc-parsed
(function).
json-rpc-call-error
(condition).
send-error
(function).
send-error-object
(function).
send-internal-error
(function).
send-nothing
(function).
*json-rpc-functions*
(special variable).
+empty-array+
(constant).
def-restart
(macro).
defconstant
(macro).
encapsulated-error
(reader method).
encode-json-rpc-value
(generic function).
json-rpc-encoding-p
(generic function).
make-json-rpc-error-object-1.1
(function).
make-json-rpc-error-object-2.0
(function).
make-rpc-response
(function).
Packages are listed by definition order.
json-rpc
common-lisp
.
json
.
*json-rpc-version*
(special variable).
+json-rpc-1.1+
(constant).
+json-rpc-2.0+
(constant).
clear-exported
(function).
def-json-rpc-encoding
(macro).
defun-json-rpc
(macro).
export-as-json-rpc
(function).
invoke-rpc
(function).
invoke-rpc-parsed
(function).
json-rpc-call-error
(condition).
send-error
(function).
send-error-object
(function).
send-internal-error
(function).
send-nothing
(function).
*json-rpc-functions*
(special variable).
+empty-array+
(constant).
def-restart
(macro).
defconstant
(macro).
encapsulated-error
(generic reader).
encode-json-rpc-value
(generic function).
json-rpc-encoding-p
(generic function).
make-json-rpc-error-object-1.1
(function).
make-json-rpc-error-object-2.0
(function).
make-rpc-response
(function).
json
cl-json
common-lisp
.
*aggregate-scope-variables*
(special variable).
*array-member-handler*
(special variable).
*array-scope-variables*
(special variable).
*beginning-of-array-handler*
(special variable).
*beginning-of-object-handler*
(special variable).
*beginning-of-string-handler*
(special variable).
*boolean-handler*
(special variable).
*end-of-array-handler*
(special variable).
*end-of-object-handler*
(special variable).
*end-of-string-handler*
(special variable).
*identifier-name-to-key*
(special variable).
*integer-handler*
(special variable).
*internal-decoder*
(special variable).
*json-array-type*
(special variable).
*json-identifier-name-to-lisp*
(special variable).
*json-input*
(special variable).
*json-output*
(special variable).
*json-symbols-package*
(special variable).
*lisp-identifier-name-to-json*
(special variable).
*object-key-handler*
(special variable).
*object-scope-variables*
(special variable).
*object-value-handler*
(special variable).
*prototype-name*
(special variable).
*real-handler*
(special variable).
*string-char-handler*
(special variable).
*string-scope-variables*
(special variable).
*use-strict-json-rules*
(special variable).
as-array-member
(macro).
as-object-member
(macro).
bind-custom-vars
(macro).
camel-case-to-lisp
(function).
clear-class-registry
(function).
current-decoder
(macro).
custom-decoder
(macro).
decode-json
(function).
decode-json-from-source
(function).
decode-json-from-string
(function).
decode-json-strict
(function).
encode-array-member
(function).
encode-json
(generic function).
encode-json-alist
(function).
encode-json-alist-to-string
(function).
encode-json-plist
(function).
encode-json-plist-to-string
(function).
encode-json-to-string
(function).
encode-object-member
(function).
fluid-class
(class).
fluid-object
(class).
json-bind
(macro).
json-bool
(function).
json-intern
(function).
json-or-null
(function).
json-syntax-error
(function).
json-syntax-error
(condition).
lisp-to-camel-case
(function).
make-object
(generic function).
make-object-prototype
(generic function).
no-char-for-code
(condition).
prototype
(class).
safe-json-intern
(function).
set-custom-vars
(macro).
set-decoder-simple-clos-semantics
(function).
set-decoder-simple-list-semantics
(function).
simplified-camel-case-to-lisp
(function).
stream-array-member-encoder
(function).
stream-object-member-encoder
(function).
unencodable-value-error
(function).
unencodable-value-error
(condition).
unknown-symbol-error
(function).
unknown-symbol-error
(condition).
use-explicit-encoder
(function).
use-guessing-encoder
(function).
with-array
(macro).
with-custom-decoder-level
(macro).
with-decoder-simple-clos-semantics
(macro).
with-decoder-simple-list-semantics
(macro).
with-explicit-encoder
(macro).
with-guessing-encoder
(macro).
with-local-class-registry
(macro).
with-object
(macro).
with-shadowed-custom-vars
(macro).
with-substitute-printed-representation-restart
(macro).
*accumulator*
(special variable).
*accumulator-last*
(special variable).
*class-registry*
(special variable).
*custom-vars*
(special variable).
*json-aggregate-context*
(special variable).
*json-aggregate-first*
(special variable).
*json-list-encoder-fn*
(special variable).
*prototype*
(special variable).
*prototype-prototype*
(special variable).
+json-lisp-escaped-chars+
(special variable).
+json-lisp-symbol-tokens+
(special variable).
accumulator-add
(function).
accumulator-add-key
(function).
accumulator-add-key-or-set-prototype
(function).
accumulator-add-value
(function).
accumulator-add-value-or-set-prototype
(function).
accumulator-get
(function).
accumulator-get-object
(function).
accumulator-get-sequence
(function).
accumulator-get-string
(function).
aggregate-scope-progv
(macro).
camel-case-split
(function).
camel-case-transform
(function).
camel-case-transform-all-caps
(function).
custom-key-to-variable
(function).
decode-json-array
(function).
decode-json-object
(function).
decode-json-string
(function).
define-custom-var
(macro).
encode-json-list-explicit-encoder
(function).
encode-json-list-guessing-encoder
(function).
ensure-fluid-class-with-slots
(function).
escaped-char-dispatch
(macro).
find-class*
(function).
init-accumulator
(function).
init-accumulator-and-prototype
(function).
init-string-stream-accumulator
(function).
json-bind-level-customizations
(function).
json-boolean-to-lisp
(function).
let-gensyms
(macro).
lisp-class
(generic reader).
lisp-package
(generic reader).
lisp-superclasses
(generic reader).
loop-on-custom
(macro).
make-and-populate-instance
(function).
map-slots
(function).
max-package
(function).
maybe-add-prototype
(function).
next-aggregate-member
(function).
offending-code
(generic reader).
package-name*
(function).
parse-number
(function).
peek-json-token
(function).
range-keys
(function).
read-json-name-token
(function).
read-json-number-token
(function).
read-json-string-char
(function).
read-json-token
(function).
stream-error-stream-file-position
(generic reader).
string-stream-accumulator-add
(function).
string-stream-accumulator-get
(function).
unencodable-value-error-context
(generic reader).
(setf unencodable-value-error-context)
(generic writer).
unknown-symbol-error-datum
(generic reader).
(setf unknown-symbol-error-datum)
(generic writer).
with-aggregate
(macro).
with-local-encoder
(macro).
write-json-chars
(function).
write-json-number
(function).
write-json-string
(function).
json-system
asdf/interface
.
common-lisp
.
uiop/driver
.
*cl-json-directory*
(special variable).
Definitions are sorted by export status, category, package, and then by lexicographic order.
A list of symbols naming dynamic variables which should be re-bound in the scope of every JSON aggregate value (Object, Array or String).
json
.
Designator for a function of 1 arbitrary argument (decoded member of Array).
json
.
A list of symbols naming dynamic variables which should be re-bound in the scope of every JSON Array.
json
.
Designator for a function of no arguments (called at encountering an opening bracket for an Array).
json
.
Designator for a function of no arguments (called at encountering an opening brace for an Object).
json
.
Designator for a function of no arguments (called at encountering an opening quote for a String).
json
.
Designator for a function of 1 string argument (boolean token).
json
.
Designator for a function of no arguments (called at encountering a closing bracket for an Array).
json
.
Designator for a function of no arguments (called at encountering a closing brace for an Object).
json
.
Designator for a function of no arguments (called at encountering a closing quote for a String).
json
.
Designator for a function which, during decoding, maps the *json-identifier-name-to-lisp* -transformed key to the value it will have in the result object.
json
.
Designator for a function of 1 string argument (integer token).
json
.
Designator for a function of 1 stream argument called (instead of DECODE-JSON) to decode a member of an Array or of an Object.
json
.
The Lisp sequence type to which JSON Arrays are to be coerced.
json
.
Designator for a function which maps string (a JSON Object key) to string (name of a Lisp symbol).
json
.
The default input stream for decoding operations.
json
.
The default output stream for encoding operations.
json
.
Bind this variable to influence whether you want to use JSON-RPC version 1.1 or 2.0.
The package where JSON Object keys etc. are interned. Default KEYWORD, NIL = use current *PACKAGE*.
json
.
Designator for a function which maps string (name of a Lisp symbol) to string (e. g. JSON Object key).
json
.
Designator for a function of 1 string argument (decoded member key of Object).
json
.
A list of symbols naming dynamic variables which should be re-bound in the scope of every JSON Object.
json
.
Designator for a function of 1 arbitrary argument (decoded member value of Object).
json
.
The key of the prototype field in a JSON Object, and the name of a slot in a Lisp object which accepts its prototype.
json
.
Designator for a function of 1 string argument (real token).
json
.
Designator for a function of 1 character argument (String char).
json
.
A list of symbols naming dynamic variables which should be re-bound in the scope of every JSON String.
json
.
If non-nil, signal error on unrecognized escape sequences in JSON Strings. If nil, translate any such sequence to the char after slash.
json
.
BODY should be a program which encodes exactly one JSON datum to STREAM. AS-ARRAY-MEMBER ensures that the datum is properly formatted as a Member of an Array, i. e. separated by comma from any preceding or following Member.
json
.
BODY should be a program which writes exactly one JSON datum to STREAM. AS-OBJECT-MEMBER ensures that the datum is properly formatted as a Member of an Object, i. e. preceded by the (encoded) KEY and colon, and separated by comma from any preceding or following Member.
json
.
Capture current values of custom variables and return a custom decoder which restores these values in its dynamic environment.
json
.
Return a function which is like DECODE-JSON called in a dynamic environment with the given CUSTOMIZATIONS.
json
.
Define a new encoding keyword, KEYWORD. When the encoding is invoked, the raw value will be bound to VAR, and the BODY should return the encoded value.
Defines a function and registers it as a json-rpc target.
Open a JSON Array, run BODY, then close the Array. Inside the BODY, AS-ARRAY-MEMBER or ENCODE-ARRAY-MEMBER should be called to encode Members of the Array.
json
.
Execute BODY in a dynamic environment such that, when nested structures are decoded, the outermost level is decoded with the given custom handlers (CUSTOMIZATIONS) whereas inner levels are decoded in the usual way.
json
.
Execute BODY in a dynamic environement where the decoder semantics is such as set by SET-DECODER-SIMPLE-CLOS-SEMANTICS.
json
.
Execute BODY in a dynamic environement where the decoder semantics is such as set by SET-DECODER-SIMPLE-LIST-SEMANTICS.
json
.
Run BODY in a dynamic environment where *CLASS-REGISTRY* is a temporary local list. If :INHERIT is non-null, the local registry shall initially have the same content as the exterior *CLASS-REGISTRY*, otherwise it shall be NIL.
json
.
Open a JSON Object, run BODY, then close the Object. Inside the BODY, AS-OBJECT-MEMBER or ENCODE-OBJECT-MEMBER should be called to encode Members of the Object.
json
.
Establish a SUBSTITUTE-PRINTED-REPRESENTATION restart for OBJECT and execute BODY.
json
.
Take a camel-case string and convert it into a string with Lisp-style hyphenation.
json
.
Read a JSON Value from STREAM and return the corresponding Lisp value.
json
.
Decode a JSON Value from SOURCE using the value of DECODER (default ’DECODE-JSON) as decoder function. If the SOURCE is a string, the input is from this string; if it is a pathname, the input is from the file that it names; otherwise, a stream is expected as SOURCE.
json
.
Read a JSON Value from JSON-STRING and return the corresponding Lisp value.
json
.
Same as DECODE-JSON, but allow only Objects or Arrays on the top level, no junk afterwards.
json
.
Encode OBJECT as the next Member of the innermost JSON Array opened with WITH-ARRAY in the dynamic context. OBJECT is encoded using the ENCODE-JSON generic function, so it must be of a type for which an ENCODE-JSON method is defined.
json
.
Write the JSON representation (Object) of ALIST to STREAM (or to *JSON-OUTPUT*). Return NIL.
json
.
Return the JSON representation (Object) of ALIST as a string.
json
.
Write the JSON representation (Object) of PLIST to STREAM (or to *JSON-OUTPUT*). Return NIL.
json
.
Return the JSON representation (Object) of PLIST as a string.
json
.
Return the JSON representation of OBJECT as a string.
json
.
Encode KEY and VALUE as a Member pair of the innermost JSON Object opened with WITH-OBJECT in the dynamic context. KEY and VALUE are encoded using the ENCODE-JSON generic function, so they both must be of a type for which an ENCODE-JSON method is defined. If KEY does not encode to a String, its JSON representation (as a string) is encoded over again.
json
.
Registers a lambda function FUNC as a json-rpc function.
TYPE determines how the return value of FUNC should be interpreted:
:explicit using the explicit encoder syntax,
:guessing using the guessing encode syntax
:streaming as a raw JSON string.
A remote method is invoked by sending a request to a remote service. The request is a single object serialized using JSON.
It has three properties:
* method - A String containing the name of the method to be invoked.
* params - An Array of objects to pass as arguments to the method.
* id - The request id. This can be of any type. It is used to match the response with the request that it is replying to.
Intended for the JSON-EXPLICT-ENCODER. Converts a non-nil value to a value (:true) that creates a json true value when used in the explict encoder. Or (:false).
json
.
Intern STRING in the current *JSON-SYMBOLS-PACKAGE*.
json
.
Intended for the JSON-EXPLICT-ENCODER. Returns a non-nil value as itself, or a nil value as a json null-value
json
.
Signal a JSON-SYNTAX-ERROR condition.
json
.
Take a string with Lisp-style hyphentation and convert it to camel case. This is an inverse of CAMEL-CASE-TO-LISP.
json
.
The default json-intern is not safe. Interns of many
unique symbols could potentially use a lot of memory.
An attack could exploit this by submitting something that is passed
through cl-json that has many very large, unique symbols. This version
is safe in that respect because it only allows symbols that already
exists.
json
.
Set the decoder semantics to the following:
* Strings and Numbers are decoded naturally, reals becoming floats.
* The literal name true is decoded to T, false and null to NIL.
* Arrays are decoded to sequences of the type *JSON-ARRAY-TYPE*.
* Objects are decoded to CLOS objects. Object keys are converted by
the function *JSON-IDENTIFIER-NAME-TO-LISP*. If a JSON Object has a
field whose key matches *PROTOTYPE-NAME*, the class of the CLOS object
and the package wherein to intern slot names are inferred from the
corresponding value which must be a valid prototype. Otherwise, a
FLUID-OBJECT is constructed whose slot names are interned in
*JSON-SYMBOLS-PACKAGE*.
json
.
Set the decoder semantics to the following:
* Strings and Numbers are decoded naturally, reals becoming floats.
* The literal name true is decoded to T, false and null to NIL.
* Arrays are decoded to sequences of the type *JSON-ARRAY-TYPE*.
* Objects are decoded to alists. Object keys are converted by the
function *JSON-IDENTIFIER-NAME-TO-LISP* and then interned in the
package *JSON-SYMBOLS-PACKAGE*.
json
.
Insert - between lowercase and uppercase chars. Ignore _ + * and several consecutive uppercase.
json
.
Return a function which takes an argument and encodes it to STREAM as a Member of an Array. The encoding function is taken from the value of ENCODER (default is #’ENCODE-JSON).
json
.
Return a function which takes two arguments and encodes them to STREAM as a Member of an Object (String : Value pair).
json
.
Signal an UNENCODABLE-VALUE-ERROR.
json
.
Write a JSON representation of OBJECT to STREAM and return NIL.
json
.
standard-object
) &optional stream) ¶Write the JSON representation (Object) of the CLOS object O to STREAM (or to *JSON-OUTPUT*).
hash-table
) &optional stream) ¶Write the JSON representation (Object) of the hash table H to STREAM (or to *JSON-OUTPUT*).
sequence
) &optional stream) ¶Write the JSON representation (Array) of the sequence S (not an alist) to STREAM (or to *JSON-OUTPUT*).
list
) &optional stream) ¶Write the JSON representation of the list S to STREAM (or to
*JSON-OUTPUT*), using one of the two rules specified by
first calling USE-GUESSING-ENCODER or USE-EXPLICIT-ENCODER.
The guessing encoder: If S is a list encode S as a JSON Array, if
S is a dotted list encode it as an Object (per ENCODE-JSON-ALIST).
The explicit decoder: If S is a list, the first symbol defines
the encoding:
If (car S) is ’TRUE return a JSON true value.
If (car S) is ’FALSE return a JSON false value.
If (car S) is ’NULL return a JSON null value.
If (car S) is ’JSON princ the strings in (cdr s) to stream
If (car S) is ’LIST or ’ARRAY encode (cdr S) as a a JSON Array.
If (car S) is ’OBJECT encode (cdr S) as A JSON Object,
interpreting (cdr S) either as an A-LIST or a P-LIST.
symbol
) &optional stream) ¶Write the JSON representation of the symbol S to STREAM (or to *JSON-OUTPUT*). If S is boolean, a boolean literal is written. Otherwise, the name of S is passed to *LISP-IDENTIFIER-NAME-TO-JSON* and the result is written as String.
character
) &optional stream) ¶JSON does not define a character type, we encode characters as Strings.
string
) &optional stream) ¶Write the JSON representation of the string S to STREAM (or to *JSON-OUTPUT*).
number
) &optional stream) ¶Write the JSON representation of the number NR to STREAM (or to *JSON-OUTPUT*).
If OBJECT is not handled by any specialized encoder signal an error which the user can correct by choosing to encode the string which is the printed representation of the OBJECT.
If CLASS is not NIL, create an instance of that
class. Otherwise, create a fluid object whose class has the given
SUPERCLASSES (null list by default). In either case, populate the
resulting object using BINDINGS (an alist of slot names and
values).
json
.
symbol
) &optional superclasses) ¶If the CLASS is given as a symbol, find it and resort to the usual procedure.
(eql #<structure-class common-lisp:hash-table>)
) &optional superclasses) ¶If the CLASS is given as ’HASH-TABLE, return the BINDINGS as hash table.
(eql #<built-in-class common-lisp:list>)
) &optional superclasses) ¶If the CLASS is given as ’LIST, return the BINDINGS as plist.
(eql #<built-in-class common-lisp:cons>)
) &optional superclasses) ¶If the CLASS is given as ’CONS, return the BINDINGS as alist.
If the CLASS is explicitly specified, just create and populate an instance, discarding any of the BINDINGS which do not correspond to the slots of that CLASS.
(eql nil)
) &optional superclasses) ¶Create a FLUID-OBJECT with the slots given by BINDINGS and whose class has all the given SUPERCLASSES. If the current *CLASS-REGISTRY* has a member with exactly the same direct superclasses, it is updated to include all the given slots. Otherwise, a new FLUID-CLASS is allocated and added to the *CLASS-REGISTRY*.
Return a PROTOTYPE describing the OBJECT’s class or superclasses, and the package into which the names of the class / superclasses and of the OBJECT’s slots are to be interned.
json
.
prototype
) &optional slot-names) ¶Prototypes are not to be given their own prototypes, otherwise we would proceed ad malinfinitum.
symbol
) &optional slot-names) ¶Return a PROTOTYPE of an object of the class named by CLASS-NAME.
Return a PROTOTYPE describing the OBJECT’s class or superclasses, and the package into which the names of the class / superclasses and of the OBJECT’s slots are to be interned.
class
) (subclass fluid-class
)) ¶Fluid classes are thought to be anonymous, and so should not be registered in the superclass.
sb-mop
.
fluid-class
)) ¶Objects of fluid classes are fluid objects.
sb-mop
.
class
) (subclass fluid-class
)) ¶Fluid classes are thought to be anonymous, and so should not be registered in the superclass.
sb-mop
.
fluid-class
) (object fluid-object
) name (op (eql setf)
) &optional new-value) ¶On attempting to set a missing slot, add the slot to the class, then repeat SETF.
fluid-class
) (object fluid-object
) name (op (eql slot-value)
) &optional new-value) ¶On attempting to get the value of a missing slot, raise a slot-unbound error.
fluid-class
) (object fluid-object
) name (op (eql slot-makunbound)
) &optional new-value) ¶A missing slot in a fluid class is considered unbound.
fluid-class
) (object fluid-object
) name (op (eql slot-boundp)
) &optional new-value) ¶A missing slot in a fluid class is considered unbound.
fluid-class
) (superclass standard-class
)) ¶Any fluid class is also a standard class.
sb-mop
.
error
.
:error
This slot is read-only.
Signalled when non-well-formed JSON data are encountered.
Signalled when, in a JSON String, an escaped code point (uXXXX)
is encountered which is greater than the application’s CHAR-CODE-LIMIT
or for which CODE-CHAR returns NIL.
Signalled when a datum is passed to ENCODE-JSON (or another encoder function) which actually cannot be encoded.
Signalled by safe-json-intern when a symbol that is not already interned in *json-symbols-package* is found.
A class to whose instances arbitrary new slots may be added on the fly.
json
.
standard-class
.
A PROTOTYPE contains metadata for an object’s class
in a format easily serializable to JSON: either the name of the class
as a string or (if it is anonymous) the names of the superclasses as a
list of strings; and the name of the Lisp package into which the names
of the class’s slots and the name of the class / superclasses are to
be interned.
json
.
Initarg | Value |
---|---|
:lisp-class | nil |
:lisp-superclasses | nil |
:lisp-package | nil |
:lisp-class
This slot is read-only.
:lisp-superclasses
This slot is read-only.
:lisp-package
This slot is read-only.
If *ACCUMULATOR* is a list, this refers to its last cons.
json
.
A list of anonymous fluid classes, one member for every distinct combination of direct superclasses.
json
.
NIL outside of any aggregate environment, ’ARRAY or ’OBJECT within the respective environments.
json
.
T when the first member of a JSON Object or Array is encoded, afterwards NIL.
json
.
When NIL, the Object being decoded does not (yet?) have a prototype. When T, the decoder should get ready to decode a prototype field. Otherwise, the value should be a prototype for the object being decoded.
json
.
The prototype for a prototype object.
json
.
Mapping between JSON String escape sequences and Lisp chars.
json
.
Mapping between JSON literal names and Lisp boolean values.
json
.
Establish a dynamic environment where all VARIABLES are freshly bound (to their current values), and execute BODY in it, returning the result.
json
.
Compiles the escaped character alist to a (CASE ...) match expression.
json
.
Run BODY to encode a JSON aggregate type, delimited by BEGIN-CHAR and END-CHAR.
json
.
Add ELEMENT to the end of the list accumulator.
json
.
Add a cons whose CAR is KEY to the end of the list accumulator.
json
.
If KEY (in a JSON Object being decoded) matches *PROTOTYPE-NAME*, prepare to decode the corresponding Value as a PROTOTYPE object. Otherwise, do the same as ACCUMULATOR-ADD-KEY.
json
.
Set the CDR of the most recently accumulated cons to VALUE.
json
.
If VALUE (in a JSON Object being decoded) corresponds to a key which matches *PROTOTYPE-NAME*, set VALUE to be the prototype of the Object. Otherwise, do the same as ACCUMULATOR-ADD-VALUE.
json
.
Return all values accumulated so far in the list accumulator as a list.
json
.
Return a CLOS object, using keys and values accumulated so far in the list accumulator as slot names and values, respectively. If the JSON Object had a prototype field infer the class of the object and the package wherein to intern slot names from the prototype. Otherwise, create a FLUID-OBJECT with slots interned in *JSON-SYMBOLS-PACKAGE*.
json
.
Return all values accumulated so far in the list accumulator as *JSON-ARRAY-TYPE*.
json
.
Return all values accumulated so far in the list accumulator as *JSON-ARRAY-TYPE*.
json
.
Assume STRING is in camel case, and split it into largest possible
“homogenous” parts. A homogenous part consists either a) of
upper-case alphabetic chars; or b) of lower-case alphabetic chars with
an optional initial upper-case; or c) of decimal digits; or d) of a
single non-alphanumeric char. The return value is a list of
pairs (CATEGORY . PART) where CATEGORY is one of the keywords :UPPER,
:UPPER-1, :LOWER, :NUMERIC, :MIXED, and PART is a substring of
STRING.
json
.
Take a list of PARTS (as returned by CAMEL-CASE-SPLIT) and transform it into a string with Lisp-style hyphenation, assuming that some initial portion of it does not contain :UPPER parts.
json
.
Take a list of PARTS (as returned by CAMEL-CASE-SPLIT) and transform it into a string with Lisp-style hyphenation, assuming that some initial portion of it does not contain :MIXED parts.
json
.
Read comma-separated sequence of JSON Values until a closing bracket, calling array handlers as it goes.
json
.
Read comma-separated sequence of JSON String:Value pairs until a closing brace, calling object handlers as it goes.
json
.
Read JSON String characters / escape sequences until a closing double quote, calling string handlers as it goes.
json
.
Write the JSON representation of the list S to STREAM (or to *JSON-OUTPUT*). If S is not encodable as a JSON Array, try to encode it as an Object (per ENCODE-JSON-ALIST).
json
.
Create or update a fluid class, ensuring that it has (at least) all the given SLOTS and SUPERCLASSES.
json
.
Like FIND-CLASS, but allow self-designating classes for the argument, and assert that the resulting class is a STANDARD-CLASS.
json
.
Initialize a list accumulator and a prototype.
json
.
Initialize a string-stream accumulator.
json
.
json
.
Take a literal name token and convert it to a boolean value.
json
.
Make an instance of the given CLASS, and set its slots to given values. BINDINGS must be a list of pairs whose CARs are slot names and CDRs are the respective values. If no slot of a given name is defined in the CLASS, the corresponding value is discarded.
json
.
This code is based on the Working Draft 7 August 2006 of Json-rpc 1.1 specification. http://json-rpc.org/wd/JSON-RPC-1-1-WD-20060807.html
When the method invocation completes, the service must reply with a response. The response is a single object serialized using JSON.
It has three properties:
* result - The Object that was returned by the invoked method. This must be null in case there was an error invoking the method. * error - An Error object(unspecified in json-rpc 1.0) if there was an error invoking the method. Null if there was no error. * id - This must be the same id as the request it is responding to.
Call FUNCTION on the name and value of every bound slot in OBJECT.
json
.
Try to find a package P such that the names of the given SYMBOLS, when interned in P, yield the same symbols. If no such package exists, return an unspecific value and issue a warning.
json
.
If the PROTOTYPE is not NIL, and the OBJECT has a slot to accept it, do set it. Return OBJECT.
json
.
Between two members of an Object or Array, print a comma separator.
json
.
Same as PACKAGE-NAME, but ensure that the result is a symbol.
json
.
Take a number token and convert it to a numeric value.
json
.
Return 2 values: the category and the first character of the next token available in the given STREAM. Unlike READ-JSON-TOKEN, this function can not discriminate between integers and reals (hence, it returns a single :NUMBER category), and cannot check whether the next available symbol is a valid boolean or not (hence, the category for such tokens is :SYMBOL).
json
.
Read a JSON literal name token from the given STREAM, and return 2 values: the token category (:BOOLEAN) and the token itself, as a string.
json
.
Read a JSON number token from the given STREAM, and return 2 values: the token category (:INTEGER or :REAL) and the token itself, as a string.
json
.
Read a JSON String char (or escape sequence) from the STREAM and return it. If an end of string (unescaped quote) is encountered, return NIL.
json
.
Read a JSON token (literal name, number or punctuation char) from the given STREAM, and return 2 values: the token category (a symbol) and the token itself, as a string or character.
json
.
Add CHAR to the end of the string-stream accumulator.
json
.
Return all characters accumulated so far in a string-stream accumulator and close the stream.
json
.
Write JSON representations (chars or escape sequences) of characters in string S to STREAM.
json
.
Write the JSON representation of the number NR to STREAM.
json
.
Write a JSON representation (String) of S to STREAM.
json
.
json-rpc-call-error
)) ¶Translate RAW-VALUE according to JSON-RPC value encoding ENCODING
(eql :array)
)) ¶(eql :boolean)
)) ¶(eql :guessing)
)) ¶(eql :streaming)
)) ¶(eql :explicit)
)) ¶Is KEYWORD a valid JSON-RPC value encoding?
(eql :array)
)) ¶(eql :boolean)
)) ¶Default is no.
(eql :guessing)
)) ¶(eql :streaming)
)) ¶(eql :explicit)
)) ¶json
.
no-char-for-code
)) ¶json
.
json-syntax-error
)) ¶json
.
unencodable-value-error
)) ¶unencodable-value-error
)) ¶json
.
unknown-symbol-error
)) ¶unknown-symbol-error
)) ¶Jump to: | (
A B C D E F G I J L M N O P R S U V W |
---|
Jump to: | (
A B C D E F G I J L M N O P R S U V W |
---|
Jump to: | *
+
C D E L O S |
---|
Jump to: | *
+
C D E L O S |
---|
Jump to: | C D E F J M N O P S U |
---|
Jump to: | C D E F J M N O P S U |
---|