The st-json Reference Manual

This is the st-json Reference Manual, generated automatically by Declt version 4.0 beta 2 "William Riker" on Wed May 15 06:58:11 2024 GMT+0.

Table of Contents


1 Introduction


2 Systems

The main system appears first, followed by any subsystem dependency.


2.1 st-json

JSON in- and output

Author

Marijn Haverbeke <>

License

BSD

Source

st-json.asd.

Child Component

st-json.lisp (file).


3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


3.1 Lisp


3.1.1 st-json/st-json.asd

Source

st-json.asd.

Parent Component

st-json (system).

ASDF Systems

st-json.


3.1.2 st-json/st-json.lisp

Source

st-json.asd.

Parent Component

st-json (system).

Packages

st-json.

Public Interface
Internals

4 Packages

Packages are listed by definition order.


4.1 st-json

Source

st-json.lisp.

Use List

common-lisp.

Public Interface
Internals

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


5.1 Public Interface


5.1.1 Special variables

Special Variable: *allow-comments*

Non-nil means ignore comments when parsing.

Package

st-json.

Source

st-json.lisp.

Special Variable: *decode-objects-as*

Valid values: :jso :hashtable
Controls how js objects should be decoded. :jso means decode to internal struct which can be processed by getjso, mapjso etc. :hashtable means decode as hash tables.

Package

st-json.

Source

st-json.lisp.

Special Variable: *output-literal-unicode*

Bind this to T in order to reduce the use of uXXXX Unicode escapes, by emitting literal characters (encoded in UTF-8). This may help reduce the parsing effort for any recipients of the JSON output, if they can already read UTF-8, or else, they’ll need to implement complex unicode (eg UTF-16 surrogate pairs) escape parsers.

Package

st-json.

Source

st-json.lisp.

Special Variable: *script-tag-hack*

Bind this to T when writing JSON that will be written to an HTML document. It prevents ’</script>’ from occurring in strings by escaping any slash following a ’<’ character.

Package

st-json.

Source

st-json.lisp.


5.1.2 Macros

Macro: getjso* (keys jso)
Package

st-json.

Source

st-json.lisp.


5.1.3 Ordinary functions

Function: as-json-bool (value)

Convert a generalised boolean to a :true/:false keyword.

Package

st-json.

Source

st-json.lisp.

Function: from-json-bool (value)

Convert :true or :false to its boolean equivalent.

Package

st-json.

Source

st-json.lisp.

Function: getjso (key map)

Fetch a value from a JS object. Returns a second value like gethash.

Package

st-json.

Source

st-json.lisp.

Function: (setf getjso) (key map)

Store a value in a JS object.

Package

st-json.

Source

st-json.lisp.

Function: jso (&rest fields)

Create a JS object. Arguments should be alternating labels and values.

Package

st-json.

Source

st-json.lisp.

Function: mapjso (func map)

Iterate over the key/value pairs in a JS object.

Package

st-json.

Source

st-json.lisp.

Function: read-json-as-type (source type)

Read a JSON value and assert the result to be of a given type. Raises a json-type-error when the type is wrong.

Package

st-json.

Source

st-json.lisp.

Function: read-json-from-string (string &key start end junk-allowed-p)
Package

st-json.

Source

st-json.lisp.

Function: write-json (element stream)

Write a value’s JSON representation to a stream.

Package

st-json.

Source

st-json.lisp.

Function: write-json-to-string (element)

Write a value’s JSON representation to a string.

Package

st-json.

Source

st-json.lisp.


5.1.4 Generic functions

Generic Function: read-json (in &optional junk-allowed-p)

Read a JSON-encoded value from a stream or a string.

Package

st-json.

Source

st-json.lisp.

Methods
Method: read-json ((in string) &optional junk-allowed-p)
Method: read-json ((in stream) &optional junk-allowed-p)
Generic Function: write-json-element (element stream)

Method used for writing values of a specific type. You can specialise this for your own types.

Package

st-json.

Source

st-json.lisp.

Methods
Method: write-json-element ((element list) stream)
Method: write-json-element ((element jso) stream)
Method: write-json-element ((element hash-table) stream)
Method: write-json-element ((element real) stream)
Method: write-json-element ((element integer) stream)
Method: write-json-element ((element string) stream)
Method: write-json-element ((element symbol) stream)
Method: write-json-element (element stream)

5.1.5 Conditions

Condition: json-eof-error
Package

st-json.

Source

st-json.lisp.

Direct superclasses

json-parse-error.

Condition: json-error
Package

st-json.

Source

st-json.lisp.

Direct superclasses

simple-error.

Direct subclasses
Condition: json-parse-error
Package

st-json.

Source

st-json.lisp.

Direct superclasses

json-error.

Direct subclasses

json-eof-error.

Condition: json-type-error
Package

st-json.

Source

st-json.lisp.

Direct superclasses

json-error.


5.1.6 Structures

Structure: jso
Package

st-json.

Source

st-json.lisp.

Direct superclasses

structure-object.

Direct methods

write-json-element.

Direct slots
Slot: alist
Readers

jso-alist.

Writers

(setf jso-alist).


5.1.7 Types

Type: json-bool ()
Package

st-json.

Source

st-json.lisp.

Type: json-null ()
Package

st-json.

Source

st-json.lisp.


5.2 Internals


5.2.1 Special variables

Special Variable: *optimize*
Package

st-json.

Source

st-json.lisp.

Special Variable: *reading-slot-name*
Package

st-json.

Source

st-json.lisp.


5.2.2 Ordinary functions

Function: at-eof (stream)
Package

st-json.

Source

st-json.lisp.

Function: copy-jso (instance)
Package

st-json.

Source

st-json.lisp.

Function: ends-atom (char)
Package

st-json.

Source

st-json.lisp.

Function: gather-comma-separated (stream end-char obj-name gather-func)
Package

st-json.

Source

st-json.lisp.

Function: is-whitespace (char)
Package

st-json.

Source

st-json.lisp.

Reader: jso-alist (instance)
Writer: (setf jso-alist) (instance)
Package

st-json.

Source

st-json.lisp.

Target Slot

alist.

Function: jso-p (object)
Package

st-json.

Source

st-json.lisp.

Function: looks-like-a-number (string)
Package

st-json.

Source

st-json.lisp.

Function: make-jso (&key alist)
Package

st-json.

Source

st-json.lisp.

Function: raise (type format &rest args)
Package

st-json.

Source

st-json.lisp.

Function: read-json-atom (stream)
Package

st-json.

Source

st-json.lisp.

Function: read-json-element (stream)
Package

st-json.

Source

st-json.lisp.

Function: read-json-list (stream)
Package

st-json.

Source

st-json.lisp.

Function: read-json-object (stream)
Package

st-json.

Source

st-json.lisp.

Function: read-json-string (stream)
Package

st-json.

Source

st-json.lisp.

Function: skip-cpp-comment (stream)
Package

st-json.

Source

st-json.lisp.

Function: skip-whitespace (stream)
Package

st-json.

Source

st-json.lisp.


5.2.3 Conditions

Condition: json-write-error
Package

st-json.

Source

st-json.lisp.

Direct superclasses

json-error.


Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   (  
A   C   E   F   G   I   J   L   M   R   S   W  
Index Entry  Section

(
(setf getjso): Public ordinary functions
(setf jso-alist): Private ordinary functions

A
as-json-bool: Public ordinary functions
at-eof: Private ordinary functions

C
copy-jso: Private ordinary functions

E
ends-atom: Private ordinary functions

F
from-json-bool: Public ordinary functions
Function, (setf getjso): Public ordinary functions
Function, (setf jso-alist): Private ordinary functions
Function, as-json-bool: Public ordinary functions
Function, at-eof: Private ordinary functions
Function, copy-jso: Private ordinary functions
Function, ends-atom: Private ordinary functions
Function, from-json-bool: Public ordinary functions
Function, gather-comma-separated: Private ordinary functions
Function, getjso: Public ordinary functions
Function, is-whitespace: Private ordinary functions
Function, jso: Public ordinary functions
Function, jso-alist: Private ordinary functions
Function, jso-p: Private ordinary functions
Function, looks-like-a-number: Private ordinary functions
Function, make-jso: Private ordinary functions
Function, mapjso: Public ordinary functions
Function, raise: Private ordinary functions
Function, read-json-as-type: Public ordinary functions
Function, read-json-atom: Private ordinary functions
Function, read-json-element: Private ordinary functions
Function, read-json-from-string: Public ordinary functions
Function, read-json-list: Private ordinary functions
Function, read-json-object: Private ordinary functions
Function, read-json-string: Private ordinary functions
Function, skip-cpp-comment: Private ordinary functions
Function, skip-whitespace: Private ordinary functions
Function, write-json: Public ordinary functions
Function, write-json-to-string: Public ordinary functions

G
gather-comma-separated: Private ordinary functions
Generic Function, read-json: Public generic functions
Generic Function, write-json-element: Public generic functions
getjso: Public ordinary functions
getjso*: Public macros

I
is-whitespace: Private ordinary functions

J
jso: Public ordinary functions
jso-alist: Private ordinary functions
jso-p: Private ordinary functions

L
looks-like-a-number: Private ordinary functions

M
Macro, getjso*: Public macros
make-jso: Private ordinary functions
mapjso: Public ordinary functions
Method, read-json: Public generic functions
Method, read-json: Public generic functions
Method, write-json-element: Public generic functions
Method, write-json-element: Public generic functions
Method, write-json-element: Public generic functions
Method, write-json-element: Public generic functions
Method, write-json-element: Public generic functions
Method, write-json-element: Public generic functions
Method, write-json-element: Public generic functions
Method, write-json-element: Public generic functions

R
raise: Private ordinary functions
read-json: Public generic functions
read-json: Public generic functions
read-json: Public generic functions
read-json-as-type: Public ordinary functions
read-json-atom: Private ordinary functions
read-json-element: Private ordinary functions
read-json-from-string: Public ordinary functions
read-json-list: Private ordinary functions
read-json-object: Private ordinary functions
read-json-string: Private ordinary functions

S
skip-cpp-comment: Private ordinary functions
skip-whitespace: Private ordinary functions

W
write-json: Public ordinary functions
write-json-element: Public generic functions
write-json-element: Public generic functions
write-json-element: Public generic functions
write-json-element: Public generic functions
write-json-element: Public generic functions
write-json-element: Public generic functions
write-json-element: Public generic functions
write-json-element: Public generic functions
write-json-element: Public generic functions
write-json-to-string: Public ordinary functions