This is the njson Reference Manual, version 0.2.4, generated automatically by Declt version 4.0 beta 2 "William Riker" on Wed Mar 15 07:06:34 2023 GMT+0.
The main system appears first, followed by any subsystem dependency.
njson
NJSON is a JSON handling framework with the focus on convenience and brevity.
Atlas Engineer LLC
BSD-3 Clause
0.2.4
package.lisp
(file).
conditions.lisp
(file).
njson.lisp
(file).
functions.lisp
(file).
macros.lisp
(file).
aliases.lisp
(file).
Files are sorted by type and then listed depth-first from the systems components trees.
njson/njson.asd
njson/package.lisp
njson/conditions.lisp
njson/njson.lisp
njson/functions.lisp
njson/macros.lisp
njson/aliases.lisp
njson/conditions.lisp
package.lisp
(file).
njson
(system).
decode-from-stream-not-implemented
(condition).
encode-to-stream-not-implemented
(condition).
invalid-key
(condition).
non-indexable
(condition).
deprecated
(reader method).
(setf deprecated)
(writer method).
deprecated
(condition).
key
(reader method).
(setf key)
(writer method).
object
(reader method).
(setf object)
(writer method).
replacement
(reader method).
(setf replacement)
(writer method).
type-num
(function).
value
(reader method).
(setf value)
(writer method).
njson/njson.lisp
conditions.lisp
(file).
njson
(system).
decode
(generic function).
decode-from-file
(generic function).
decode-from-stream
(generic function).
decode-from-string
(generic function).
encode
(generic function).
encode-to-file
(generic function).
encode-to-stream
(generic function).
encode-to-string
(generic function).
njson/functions.lisp
njson.lisp
(file).
njson
(system).
copy_
(function).
get_
(function).
(setf get_)
(function).
has_
(function).
jcopy
(generic function).
jget
(generic function).
(setf jget)
(generic function).
jhas
(generic function).
jnot
(function).
jrem
(generic function).
jtruep
(generic function).
not_
(function).
rem_
(function).
true-p
(function).
true?
(function).
truep
(function).
njson/macros.lisp
functions.lisp
(file).
njson
(system).
njson/aliases.lisp
macros.lisp
(file).
njson
(system).
Packages are listed by definition order.
njson
NJSON is a convenience library for JSON handling. Important functions/APIs:
- ‘njson:encode’ and ‘njson:decode’ as universal (en|de)coding functions working
on strings, streams, and pathnames.
- ‘njson:jget’ (and ‘njson:get_’ alias) to get the value from decoded
and arbitrarily nested JSON array/object.
- ‘njson:jtruep’ (and aliases) to check the non-falsity of a decoded
value.
- ‘njson:jif’, ‘njson:jwhen’, ‘njson:jor’, ‘njson:jand’, and
‘njson:jnot’ (and aliases) as convenience macros for JSON
non-falsity-based control flow.
Generics to implement:
- ‘njson:encode-to-stream’ and ‘njson:decode-from-stream’ as the basic
methods to specialize for every backend.
- ‘njson:encode-to-string’ and ‘njson:encode-to-file’, as more specific
methods to speed things up.
- ‘njson:decode-from-string’ and ‘njson:decode-from-file’, as more
specific decoding methods.
common-lisp
.
and_
(macro).
copy_
(function).
decode
(generic function).
decode-from-file
(generic function).
decode-from-stream
(generic function).
decode-from-stream-not-implemented
(condition).
decode-from-string
(generic function).
encode
(generic function).
encode-to-file
(generic function).
encode-to-stream
(generic function).
encode-to-stream-not-implemented
(condition).
encode-to-string
(generic function).
get_
(function).
(setf get_)
(function).
has_
(function).
if_
(macro).
invalid-key
(condition).
jand
(macro).
jcopy
(generic function).
jget
(generic function).
(setf jget)
(generic function).
jhas
(generic function).
jif
(macro).
jnot
(function).
jor
(macro).
jrem
(generic function).
jtrue-p
(generic function).
jtrue?
(generic function).
jtruep
(generic function).
jwhen
(macro).
non-indexable
(condition).
not_
(function).
or_
(macro).
rem_
(function).
true-p
(function).
true?
(function).
truep
(function).
when_
(macro).
deprecated
(generic reader).
(setf deprecated)
(generic writer).
deprecated
(condition).
key
(generic reader).
(setf key)
(generic writer).
object
(generic reader).
(setf object)
(generic writer).
replacement
(generic reader).
(setf replacement)
(generic writer).
type-num
(function).
value
(generic reader).
(setf value)
(generic writer).
njson/aliases
Short aliases for the regular njson functions.
Perfect with j: package-local-nickname, disastrous when :use-d.
common-lisp
.
and
(macro).
copy
(generic function).
decode
(generic function).
encode
(generic function).
get
(generic function).
(setf get)
(generic function).
has
(generic function).
if
(macro).
not
(function).
or
(macro).
rem
(generic function).
true
(generic function).
true?
(generic function).
truep
(generic function).
when
(macro).
Definitions are sorted by export status, category, package, and then by lexicographic order.
JSON-aware version of ‘cl:and’.
JSON-aware version of ‘cl:and’. Alias for ‘jand’.
JSON-aware version of ‘cl:if’.
If TEST is ‘njson:jtruep’ evaluate THEN, otherwise evaluate ELSE.
Alias for ‘njson:jif’.
JSON-aware version of ‘cl:if’.
If TEST is ‘jtruep’ evaluate THEN, otherwise evaluate ELSE.
Alias for ‘jif’.
JSON-aware version of ‘cl:and’.
JSON-aware version of ‘cl:if’.
If TEST is ‘jtruep’ evaluate THEN, otherwise evaluate ELSE.
JSON-aware version of ‘cl:or’.
JSON-aware version of ‘cl:when’. If TEST is ‘jtruep’ evaluate BODY.
JSON-aware version of ‘cl:or’.
JSON-aware version of ‘cl:or’. Alias for ‘jor’.
JSON-aware version of ‘cl:when’.
If TEST is ‘njson:jtruep’ evaluate BODY.
JSON-aware version of ‘cl:when’. If TEST is ‘jtruep’ evaluate BODY. Alias for ‘jwhen’.
Copy the OBJECT, potentially creating an identical one.
For generic implementation and getails, see ‘jcopy’.
Get the value at KEY-OR-INDEX in OBJECT.
OBJECT can be JSON array or object, which in Lisp translates to any
valid ‘sequence’ ot ‘hash-table’.
For generic implementation and getails, see ‘jget’.
Set the value at KEY-OR-INDEX in OBJECT.
For generic implementation and getails, see ‘jget’.
Check the presence of the value under KEY-OR-INDEX in OBJECT.
For generic implementation and getails, see ‘jhas’.
JSON-aware version of ‘cl:not’.
JSON-aware version of ‘cl:not’.
JSON-aware version of ‘cl:not’. Alias for ‘jnot’.
Remove the value at KEY-OR-INDEX of OBJECT.
For generic implementation and getails, see ‘jrem’.
Test OBJECT for truthiness in JSON terms. For generic implementation, see ‘jtruep’.
Test OBJECT for truthiness in JSON terms. For generic implementation, see ‘jtruep’.
Test OBJECT for truthiness in JSON terms. For generic implementation, see ‘jtruep’.
Copy the OBJECT, potentially creating an identical one.
Decode OBJECT from JSON source FROM.
FROM can be a string, stream, pathname, or byte array.
Distinguishes between null/false and arrays/objects.
Decodes:
- null as :NULL,
- undefined as :UNDEFINED,
- false as nil,
- true as t,
- objects as hash-tables.
Decode OBJECT from JSON source FROM.
FROM can be a string, stream, pathname, or byte array.
Distinguishes between null/false and arrays/objects.
Decodes:
- null as :NULL,
- undefined as :UNDEFINED,
- false as nil,
- true as t,
- objects as hash-tables.
Decode JSON from FILE.
Specialize on ‘pathname’ to make NJSON better decode JSON files.
Uses ‘decode-from-stream’ by default.
Decode JSON from STREAM.
Specialize on ‘stream’ to make NJSON decode JSON.
Decode JSON from STRING.
Specialize on ‘string’ to make NJSON better decode JSON strings.
Uses ‘decode-from-stream’ by default.
Encode OBJECT to JSON output spec TO.
TO can be:
- T, in which case ‘*standard-output*’ is used as encoding stream.
- NIL, in which case OBJECT is encoded to a string.
- STREAM, in which case OBJECT is encoded to it.
- PATHNAME, in which case OBJECT is encoded to the file designated by the pathname.
Distinguishes between null and false.
Encodes:
- :NULL as null,
- :UNDEFINED as undefined,
- nil as false.
Encode OBJECT to JSON output spec TO.
TO can be:
- T, in which case ‘*standard-output*’ is used as encoding stream.
- NIL, in which case OBJECT is encoded to a string.
- STREAM, in which case OBJECT is encoded to it.
- PATHNAME, in which case OBJECT is encoded to the file designated by the pathname.
Distinguishes between null and false.
Encodes:
- :NULL as null,
- :UNDEFINED as undefined,
- nil as false.
Encode OBJECT to FILE.
Specialize on ‘pathname’ (and, optionally, OBJECT types) to make NJSON better encode JSON to files.
Uses ‘encode-to-stream’ by default.
Encode OBJECT to STREAM as JSON.
Specialize on ‘stream’ (and, optionally, OBJECT types) to make NJSON encode JSON.
Encode OBJECT to JSON string.
Specialize on ‘string’ (and, optionally, OBJECT types) to make NJSON better encode JSON to strings.
Uses ‘encode-to-stream’ by default.
Get the value at KEY-OR-INDEX in OBJECT.
KEY-OR-INDEX can be
- an integer (for array indexing),
- a string (for object keying),
- or a sequence of integers and strings (to index the nested
structures).
Throws ‘invalid-key’ if using the wrong index type.
Throws ‘non-indexable’ when trying to index something other than JSON
arrays or objects.
For example, to get the data from a structure like
{"data": [1, 2, {"three": 3}]}
you can use
(jget #("data" 2 "three") data)
;; => 3
OBJECT can be JSON array or object, which in Lisp translates to any valid ‘sequence’ ot ‘hash-table’.
jget
.
Set the value at KEY-OR-INDEX in OBJECT.
KEY-OR-INDEX can be
- an integer (for array indexing),
- a string (for object keying),
- or a sequence of integers and strings (to modify the nested
structures).
Throws ‘invalid-key’ if using the wrong index type.
Throws ‘non-indexable’ when trying to index something other than JSON
arrays or objects.
OBJECT can be JSON array or object, which in Lisp translates to any valid ‘sequence’ ot ‘hash-table’.
Check the presence of the value under KEY-OR-INDEX in OBJECT.
The arguments are the same as in ‘jget’.
Throws ‘invalid-key’ if using the wrong index type.
Throws ‘non-indexable’ when trying to index something other than JSON
arrays or objects.
jhas
.
Copy the OBJECT, potentially creating an identical one.
real
)) ¶(eql :null)
)) ¶(eql :undefined)
)) ¶(eql t)
)) ¶null
)) ¶string
)) ¶sequence
)) ¶hash-table
)) ¶Get the value at KEY-OR-INDEX in OBJECT.
KEY-OR-INDEX can be
- an integer (for array indexing),
- a string (for object keying),
- or a sequence of integers and strings (to index the nested
structures).
Throws ‘invalid-key’ if using the wrong index type.
Throws ‘non-indexable’ when trying to index something other than JSON
arrays or objects.
For example, to get the data from a structure like
{"data": [1, 2, {"three": 3}]}
you can use
(jget #("data" 2 "three") data)
;; => 3
OBJECT can be JSON array or object, which in Lisp translates to any valid ‘sequence’ ot ‘hash-table’.
sequence
) object) ¶integer
) (object sequence
)) ¶string
) (object hash-table
)) ¶string
)) ¶string
) (object sequence
)) ¶integer
) (object hash-table
)) ¶Set the value at KEY-OR-INDEX in OBJECT.
KEY-OR-INDEX can be
- an integer (for array indexing),
- a string (for object keying),
- or a sequence of integers and strings (to modify the nested
structures).
Throws ‘invalid-key’ if using the wrong index type.
Throws ‘non-indexable’ when trying to index something other than JSON
arrays or objects.
OBJECT can be JSON array or object, which in Lisp translates to any valid ‘sequence’ ot ‘hash-table’.
sequence
) object) ¶integer
) (object sequence
)) ¶string
) (object hash-table
)) ¶string
)) ¶string
) (object sequence
)) ¶integer
) (object hash-table
)) ¶Check the presence of the value under KEY-OR-INDEX in OBJECT.
The arguments are the same as in ‘jget’.
Throws ‘invalid-key’ if using the wrong index type.
Throws ‘non-indexable’ when trying to index something other than JSON
arrays or objects.
sequence
) object) ¶integer
) (object sequence
)) ¶string
) (object hash-table
)) ¶string
)) ¶string
) (object sequence
)) ¶integer
) (object hash-table
)) ¶Remove the value at KEY-OR-INDEX of OBJECT.
The arguments are the same as in ‘jget’.
Throws ‘invalid-key’ if using the wrong index type.
Throws ‘non-indexable’ when trying to index something other than JSON
arrays or objects.
sequence
) object) ¶integer
) (object sequence
)) ¶string
) (object hash-table
)) ¶string
)) ¶string
) (object sequence
)) ¶integer
) (object hash-table
)) ¶Test OBJECT for truthiness in JSON terms.
Test OBJECT for truthiness in JSON terms.
Test OBJECT for truthiness in JSON terms.
Remove the value at KEY-OR-INDEX of OBJECT.
The arguments are the same as in ‘jget’.
Throws ‘invalid-key’ if using the wrong index type.
Throws ‘non-indexable’ when trying to index something other than JSON
arrays or objects.
jrem
.
Test OBJECT for truthiness in JSON terms.
Test OBJECT for truthiness in JSON terms.
Test OBJECT for truthiness in JSON terms.
error
.
error
.
condition
.
:value
deprecated
)) ¶deprecated
)) ¶invalid-key
)) ¶invalid-key
)) ¶key
.
invalid-key
)) ¶invalid-key
)) ¶deprecated
)) ¶deprecated
)) ¶non-indexable
)) ¶non-indexable
)) ¶Jump to: | (
A C D E F G H I J K M N O R T V W |
---|
Jump to: | (
A C D E F G H I J K M N O R T V W |
---|
Jump to: | D K O R S V |
---|
Jump to: | D K O R S V |
---|
Jump to: | A C D E F I M N P S |
---|
Jump to: | A C D E F I M N P S |
---|