The cl-jsonpath Reference Manual

This is the cl-jsonpath Reference Manual, version 1.0.0, generated automatically by Declt version 4.0 beta 2 "William Riker" on Fri May 15 11:52:18 2026 GMT+0.

Table of Contents


1 Introduction


2 Systems

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


2.1 cl-jsonpath

JSONPath implementation for Common Lisp with 99% test coverage and complete RFC 9535 compliance. Supports cl-json, jonathan, and jzon backends with advanced features including arithmetic expressions, recursive descent, and bracket notation in filters.

Author

Gabor Poczkodi

Home Page

https://git.sr.ht/~hajovonta/cl-jsonpath

Source Control

(GIT https://git.sr.ht/~hajovonta/cl-jsonpath)

Bug Tracker

https://todo.sr.ht/~hajovonta/cl-jsonpath

License

MIT

Version

1.0.0

Dependencies
  • cl-ppcre (system).
  • parse-number (system).
Source

cl-jsonpath.asd.

Child Components

3 Files

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


3.1 Lisp


3.1.1 cl-jsonpath/cl-jsonpath.asd

Source

cl-jsonpath.asd.

Parent Component

cl-jsonpath (system).

ASDF Systems

cl-jsonpath.


3.1.2 cl-jsonpath/package.lisp

Source

cl-jsonpath.asd.

Parent Component

cl-jsonpath (system).

Packages

cl-jsonpath.


3.1.3 cl-jsonpath/cl-jsonpath.lisp

Dependency

package.lisp (file).

Source

cl-jsonpath.asd.

Parent Component

cl-jsonpath (system).

Public Interface
Internals

4 Packages

Packages are listed by definition order.


4.1 cl-jsonpath

Source

package.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: *default-backend*

Default backend for JSON processing. :auto, :cl-json, or :jonathan

Package

cl-jsonpath.

Source

cl-jsonpath.lisp.


5.1.2 Ordinary functions

Function: detect-backend (parsed-data)

Auto-detect JSON/XML backend based on data structure

Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Function: extract (data path-string &key backend)

Extract data using JSONPath string - new architecture

Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Function: extract-one (data path-string &key backend)

Extract single item using JSONPath string - new architecture

Package

cl-jsonpath.

Source

cl-jsonpath.lisp.


5.2 Internals


5.2.1 Special variables

Special Variable: *json-null*

Special marker to distinguish JSON null from Lisp NIL

Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Special Variable: *jsonpath-token-patterns*

Token patterns for JSONPath lexical analysis

Package

cl-jsonpath.

Source

cl-jsonpath.lisp.


5.2.2 Ordinary functions

Function: advance-token (parser-state)

Advance to next token

Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Function: apply-filter-function (func-name value)

Apply filter function to value

Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Function: apply-function (function-name target-list)

Apply JSONPath function to target data list

Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Function: compare-values (left operator right)

Compare two values using operator.
RFC 9535: null is a valid value that can be compared.
Handles different backend representations: NIL (CL-JSON/Jonathan) and NULL symbol (JZON)

Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Function: copy-jsonpath-expression (instance)
Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Function: copy-jsonpath-token (instance)
Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Function: current-token (parser-state)

Get current token from parser state

Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Function: evaluate-arithmetic-expression (tokens item backend)

Evaluate arithmetic expression like @.price + 5 or @.info.price * 2

Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Function: evaluate-comparison (operator left right)

Simple comparison function for filter expressions

Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Function: evaluate-comparison-filter (tokens item backend)

Evaluate comparison filter expression with arithmetic support

Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Function: evaluate-count-value-function (func-name tokens item backend)

Evaluate count(@.*.author) or value(@.price) - returns count or single value

Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Function: evaluate-dynamic-path (tokens target backend)

Evaluate a dynamic path expression like @.book[0].category to get a field name

Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Function: evaluate-filter-expression (filter-tokens item backend)

Evaluate filter expression against an item - handles both wrapped and unwrapped tokens

Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Function: evaluate-filter-tokens (filter-tokens item backend)

Core filter evaluation logic

Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Function: evaluate-function-filter (tokens item backend)

Evaluate function filter: @.field.length() > 5 or match(@.field, ’pattern’) or count(@.*.author) >= 1

Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Function: evaluate-in-filter (tokens item backend)

Evaluate in filter expression: @.field in [value1, value2]

Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Function: evaluate-jsonpath (ast data &key backend)

Evaluate JSONPath AST against data

Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Function: evaluate-logical-filter (tokens item backend)

Evaluate logical filter expression with && or ||, handling parentheses

Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Function: evaluate-match-search-function (func-name tokens item backend)

Evaluate match(), search(), count(), or value() function

Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Function: evaluate-regex-filter (tokens item backend)

Evaluate regex filter expression: @.field =~ /pattern/ or @.field !~ /pattern/

Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Function: evaluate-script-expression (script-expr current-obj backend)

Evaluate script expression and return numeric result

Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Function: expect-token (parser-state expected-type)

Expect specific token type, advance if found

Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Function: get-nested-value (obj path-tokens backend)

Get value from nested path like @.info.price.
path-tokens should be alternating :dot and :identifier tokens. Returns the final value.

Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Function: get-nested-value-with-found (obj path-tokens backend)

Get value from nested path and return (values value found-p). Returns T for found-p only if all intermediate fields exist.

Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Function: get-value (obj key backend)

Get value from object using appropriate backend format

Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Function: get-value-with-found (obj key backend)

Get value from object and return (values value found-p).
This distinguishes between ’field exists with null value’ and ’field missing’.

Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Function: get-xml-children (xml-node tag-name)

Get all children of xml-node with the given tag-name. Returns a list of matching child elements.

Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Reader: jsonpath-expression-arguments (instance)
Writer: (setf jsonpath-expression-arguments) (instance)
Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Target Slot

arguments.

Reader: jsonpath-expression-operation (instance)
Writer: (setf jsonpath-expression-operation) (instance)
Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Target Slot

operation.

Function: jsonpath-expression-p (object)
Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Reader: jsonpath-expression-target (instance)
Writer: (setf jsonpath-expression-target) (instance)
Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Target Slot

target.

Reader: jsonpath-expression-type (instance)
Writer: (setf jsonpath-expression-type) (instance)
Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Target Slot

type.

Function: jsonpath-token-p (object)
Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Reader: jsonpath-token-position (instance)
Writer: (setf jsonpath-token-position) (instance)
Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Target Slot

position.

Reader: jsonpath-token-type (instance)
Writer: (setf jsonpath-token-type) (instance)
Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Target Slot

type.

Reader: jsonpath-token-value (instance)
Writer: (setf jsonpath-token-value) (instance)
Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Target Slot

value.

Function: make-jsonpath-expression (&key type target operation arguments)
Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Function: make-jsonpath-token (&key type value position)
Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Function: normalize-jzon-null (value backend)

Normalize JZON’s NULL symbol to NIL for consistency across backends. JZON backend is normalized to :hash-table, so check for both.

Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Function: parse-arithmetic-expression (parser-state)

Parse arithmetic expressions with +, -, *, /

Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Function: parse-arithmetic-factor (parser-state)

Parse arithmetic factors: numbers, @.field, $.path, or parenthesized expressions

Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Function: parse-arithmetic-term (parser-state)

Parse arithmetic terms with *, /

Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Function: parse-array-literal (tokens)

Parse array literal [value1, value2, ...] from tokens

Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Function: parse-at-reference (parser-state)

Parse @.field or @.field.function() references

Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Function: parse-bracket-expression (parser-state)

Parse content inside brackets [...]

Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Function: parse-filter-expression (parser-state)

Parse filter expression inside [?(...)] with proper parentheses handling

Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Function: parse-filter-value (token)

Parse filter value from token

Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Function: parse-float (str)

Parse float from string

Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Function: parse-jsonpath (path-string)

Parse JSONPath string into Abstract Syntax Tree

Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Function: parse-jsonpath-expression (parser-state)

Parse complete JSONPath expression

Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Function: parse-jsonpath-tokens (tokens)

Parse tokens into JSONPath AST

Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Function: parse-multi-field-expression (parser-state fields)

Parse multi-field expression: [’field1’,’field2’]

Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Function: parse-number (str)

Parse number from string

Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Function: parse-regex (regex-str)

Parse regex string /pattern/flags to pattern and flags

Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Function: parse-script-expression (parser-state)

Parse script expressions like (@.length-1) or (2+1)

Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Function: parse-segments (parser-state base-expr)

Parse JSONPath segments recursively

Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Function: parse-slice-expression (parser-state start)

Parse slice expression after colon: start:end or start:end:step

Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Function: parse-string-literal (token-value)

Parse string literal, removing quotes and handling escapes

Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Function: parse-union-expression (parser-state indices)

Parse union expression: [0,2,5]

Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Function: parse-union-indices (parser-state)

Parse union of indices: 0,1,2

Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Function: recursive-array-search (data backend)

Recursively search for all values at any level (RFC 9535: $..[*] returns all descendants)

Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Function: recursive-field-search (data field-name backend)

Recursively search for field at any level in data structure

Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Function: recursive-filter-search (obj filter-tokens backend)

Recursively search for objects matching filter at any level

Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Function: recursive-indices-search (data indices backend)

Recursively search for elements at specific indices at any depth

Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Function: recursive-wildcard-all (data backend)

Recursively get ALL values at any depth (RFC 9535: $..* returns all values)

Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Function: tokenize-jsonpath (path-string)

Tokenize JSONPath string into structured tokens

Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Function: xml-parse-value (string-value)

Parse XML string value to appropriate Lisp type. Converts numbers, booleans, and keeps strings as-is.

Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Function: xml-text-content (xml-node)

Extract text content from an XML node.
For simple elements like ("title" nil "Book 1"), returns "Book 1". For elements with multiple text nodes, concatenates them.

Package

cl-jsonpath.

Source

cl-jsonpath.lisp.


5.2.3 Generic functions

Generic Function: evaluate-expression (expression data backend)

Evaluate JSONPath expression against data

Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Methods
Method: evaluate-expression ((expr jsonpath-expression) data backend)

Evaluate JSONPath expression


5.2.4 Structures

Structure: jsonpath-expression
Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Direct superclasses

structure-object.

Direct methods

evaluate-expression.

Direct slots
Slot: type
Package

common-lisp.

Readers

jsonpath-expression-type.

Writers

(setf jsonpath-expression-type).

Slot: target
Readers

jsonpath-expression-target.

Writers

(setf jsonpath-expression-target).

Slot: operation
Readers

jsonpath-expression-operation.

Writers

(setf jsonpath-expression-operation).

Slot: arguments
Readers

jsonpath-expression-arguments.

Writers

(setf jsonpath-expression-arguments).

Structure: jsonpath-token
Package

cl-jsonpath.

Source

cl-jsonpath.lisp.

Direct superclasses

structure-object.

Direct slots
Slot: type
Package

common-lisp.

Readers

jsonpath-token-type.

Writers

(setf jsonpath-token-type).

Slot: value
Readers

jsonpath-token-value.

Writers

(setf jsonpath-token-value).

Slot: position
Package

common-lisp.

Readers

jsonpath-token-position.

Writers

(setf jsonpath-token-position).


Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   (  
A   C   D   E   F   G   J   M   N   P   R   T   X  
Index Entry  Section

(
(setf jsonpath-expression-arguments): Private ordinary functions
(setf jsonpath-expression-operation): Private ordinary functions
(setf jsonpath-expression-target): Private ordinary functions
(setf jsonpath-expression-type): Private ordinary functions
(setf jsonpath-token-position): Private ordinary functions
(setf jsonpath-token-type): Private ordinary functions
(setf jsonpath-token-value): Private ordinary functions

A
advance-token: Private ordinary functions
apply-filter-function: Private ordinary functions
apply-function: Private ordinary functions

C
compare-values: Private ordinary functions
copy-jsonpath-expression: Private ordinary functions
copy-jsonpath-token: Private ordinary functions
current-token: Private ordinary functions

D
detect-backend: Public ordinary functions

E
evaluate-arithmetic-expression: Private ordinary functions
evaluate-comparison: Private ordinary functions
evaluate-comparison-filter: Private ordinary functions
evaluate-count-value-function: Private ordinary functions
evaluate-dynamic-path: Private ordinary functions
evaluate-expression: Private generic functions
evaluate-expression: Private generic functions
evaluate-filter-expression: Private ordinary functions
evaluate-filter-tokens: Private ordinary functions
evaluate-function-filter: Private ordinary functions
evaluate-in-filter: Private ordinary functions
evaluate-jsonpath: Private ordinary functions
evaluate-logical-filter: Private ordinary functions
evaluate-match-search-function: Private ordinary functions
evaluate-regex-filter: Private ordinary functions
evaluate-script-expression: Private ordinary functions
expect-token: Private ordinary functions
extract: Public ordinary functions
extract-one: Public ordinary functions

F
Function, (setf jsonpath-expression-arguments): Private ordinary functions
Function, (setf jsonpath-expression-operation): Private ordinary functions
Function, (setf jsonpath-expression-target): Private ordinary functions
Function, (setf jsonpath-expression-type): Private ordinary functions
Function, (setf jsonpath-token-position): Private ordinary functions
Function, (setf jsonpath-token-type): Private ordinary functions
Function, (setf jsonpath-token-value): Private ordinary functions
Function, advance-token: Private ordinary functions
Function, apply-filter-function: Private ordinary functions
Function, apply-function: Private ordinary functions
Function, compare-values: Private ordinary functions
Function, copy-jsonpath-expression: Private ordinary functions
Function, copy-jsonpath-token: Private ordinary functions
Function, current-token: Private ordinary functions
Function, detect-backend: Public ordinary functions
Function, evaluate-arithmetic-expression: Private ordinary functions
Function, evaluate-comparison: Private ordinary functions
Function, evaluate-comparison-filter: Private ordinary functions
Function, evaluate-count-value-function: Private ordinary functions
Function, evaluate-dynamic-path: Private ordinary functions
Function, evaluate-filter-expression: Private ordinary functions
Function, evaluate-filter-tokens: Private ordinary functions
Function, evaluate-function-filter: Private ordinary functions
Function, evaluate-in-filter: Private ordinary functions
Function, evaluate-jsonpath: Private ordinary functions
Function, evaluate-logical-filter: Private ordinary functions
Function, evaluate-match-search-function: Private ordinary functions
Function, evaluate-regex-filter: Private ordinary functions
Function, evaluate-script-expression: Private ordinary functions
Function, expect-token: Private ordinary functions
Function, extract: Public ordinary functions
Function, extract-one: Public ordinary functions
Function, get-nested-value: Private ordinary functions
Function, get-nested-value-with-found: Private ordinary functions
Function, get-value: Private ordinary functions
Function, get-value-with-found: Private ordinary functions
Function, get-xml-children: Private ordinary functions
Function, jsonpath-expression-arguments: Private ordinary functions
Function, jsonpath-expression-operation: Private ordinary functions
Function, jsonpath-expression-p: Private ordinary functions
Function, jsonpath-expression-target: Private ordinary functions
Function, jsonpath-expression-type: Private ordinary functions
Function, jsonpath-token-p: Private ordinary functions
Function, jsonpath-token-position: Private ordinary functions
Function, jsonpath-token-type: Private ordinary functions
Function, jsonpath-token-value: Private ordinary functions
Function, make-jsonpath-expression: Private ordinary functions
Function, make-jsonpath-token: Private ordinary functions
Function, normalize-jzon-null: Private ordinary functions
Function, parse-arithmetic-expression: Private ordinary functions
Function, parse-arithmetic-factor: Private ordinary functions
Function, parse-arithmetic-term: Private ordinary functions
Function, parse-array-literal: Private ordinary functions
Function, parse-at-reference: Private ordinary functions
Function, parse-bracket-expression: Private ordinary functions
Function, parse-filter-expression: Private ordinary functions
Function, parse-filter-value: Private ordinary functions
Function, parse-float: Private ordinary functions
Function, parse-jsonpath: Private ordinary functions
Function, parse-jsonpath-expression: Private ordinary functions
Function, parse-jsonpath-tokens: Private ordinary functions
Function, parse-multi-field-expression: Private ordinary functions
Function, parse-number: Private ordinary functions
Function, parse-regex: Private ordinary functions
Function, parse-script-expression: Private ordinary functions
Function, parse-segments: Private ordinary functions
Function, parse-slice-expression: Private ordinary functions
Function, parse-string-literal: Private ordinary functions
Function, parse-union-expression: Private ordinary functions
Function, parse-union-indices: Private ordinary functions
Function, recursive-array-search: Private ordinary functions
Function, recursive-field-search: Private ordinary functions
Function, recursive-filter-search: Private ordinary functions
Function, recursive-indices-search: Private ordinary functions
Function, recursive-wildcard-all: Private ordinary functions
Function, tokenize-jsonpath: Private ordinary functions
Function, xml-parse-value: Private ordinary functions
Function, xml-text-content: Private ordinary functions

G
Generic Function, evaluate-expression: Private generic functions
get-nested-value: Private ordinary functions
get-nested-value-with-found: Private ordinary functions
get-value: Private ordinary functions
get-value-with-found: Private ordinary functions
get-xml-children: Private ordinary functions

J
jsonpath-expression-arguments: Private ordinary functions
jsonpath-expression-operation: Private ordinary functions
jsonpath-expression-p: Private ordinary functions
jsonpath-expression-target: Private ordinary functions
jsonpath-expression-type: Private ordinary functions
jsonpath-token-p: Private ordinary functions
jsonpath-token-position: Private ordinary functions
jsonpath-token-type: Private ordinary functions
jsonpath-token-value: Private ordinary functions

M
make-jsonpath-expression: Private ordinary functions
make-jsonpath-token: Private ordinary functions
Method, evaluate-expression: Private generic functions

N
normalize-jzon-null: Private ordinary functions

P
parse-arithmetic-expression: Private ordinary functions
parse-arithmetic-factor: Private ordinary functions
parse-arithmetic-term: Private ordinary functions
parse-array-literal: Private ordinary functions
parse-at-reference: Private ordinary functions
parse-bracket-expression: Private ordinary functions
parse-filter-expression: Private ordinary functions
parse-filter-value: Private ordinary functions
parse-float: Private ordinary functions
parse-jsonpath: Private ordinary functions
parse-jsonpath-expression: Private ordinary functions
parse-jsonpath-tokens: Private ordinary functions
parse-multi-field-expression: Private ordinary functions
parse-number: Private ordinary functions
parse-regex: Private ordinary functions
parse-script-expression: Private ordinary functions
parse-segments: Private ordinary functions
parse-slice-expression: Private ordinary functions
parse-string-literal: Private ordinary functions
parse-union-expression: Private ordinary functions
parse-union-indices: Private ordinary functions

R
recursive-array-search: Private ordinary functions
recursive-field-search: Private ordinary functions
recursive-filter-search: Private ordinary functions
recursive-indices-search: Private ordinary functions
recursive-wildcard-all: Private ordinary functions

T
tokenize-jsonpath: Private ordinary functions

X
xml-parse-value: Private ordinary functions
xml-text-content: Private ordinary functions