The cl-json-helper Reference Manual

Next: , Previous: , Up: (dir)   [Contents][Index]

The cl-json-helper Reference Manual

This is the cl-json-helper Reference Manual, version 1.1.0, generated automatically by Declt version 4.0 beta 2 "William Riker" on Thu Sep 15 03:52:52 2022 GMT+0.

Table of Contents


1 Introduction

###cl-json-helper: A Common Lisp library to assist cl-json.

cl-json encodes and decodes JSON data. cl-json-helper adds two functions to help encoding JSON data and one function to help in processing decoded JSON data.

The nickname xjson can be used for the cl-json-helper package.

[Function] json-empty ()

	The return value is decoded by cl-json as {}.
	
	Example:
		(cl-json:encode-json-to-string `(("Empty" . ,(xjson:json-empty))))
	=> "{\"Empty\":{}}"

[Function] json-bool (val)

	Encodes val as "true" or "false"

	Examples:
		(cl-json:encode-json-to-string `(("TRUE" . ,(xjson:json-bool t))))
	=> "{\"TRUE\":true}"
		(cl-json:encode-json-to-string `(("FALSE" . ,(xjson:json-bool nil))))
	=> "{\"FALSE\":false}"

[Function] json-key-value (key list &key (test #'eql))

	Return the value associated with _key_ in a decoded JSON list, if present, and whether
	or not _key_ was found.
	
	(cl-json:encode-json-to-string '(("HELLO" . "WORLD")
	                                 ("ITS" . "ME")
	                                 ("CEST" . "MOI")))
	=> "{\"HELLO\":\"WORLD\",\"ITS\":\"ME\",\"CEST\":\"MOI\"}"
	
	(cl-json:decode-json-from-string "{\"HELLO\":\"WORLD\",\"ITS\":\"ME\",\"CEST\":\"MOI\"}")
	=> ((:+HELLO+ . "WORLD") (:+ITS+ . "ME") (:+CEST+ . "MOI"))
	
	(xjson:json-key-value :+CEST+ '((:+HELLO+ . "WORLD") (:+ITS+ . "ME") (:+CEST+ . "MOI")))
	=> "MOI"
	   T
	
	(xjson:json-key-value :+FALSE+ (cl-json:decode-json-from-string "{\"FALSE\":false}"))
	=> NIL
	   T
	
	(xjson:json-key-value :+BAR+ (cl-json:decode-json-from-string "{\"FALSE\":false}"))
	=> NIL
	   NIL

json-key-value is just a glorified call to Lisp's assoc

Repository

https://github.com/stablecross/cl-json-helper

####License cl-json-helper is available under a BSD-like license. See the file LICENSE for details.

Contact

For any questions or comments, please feel free to email me, Bob Felts wrf3@stablecross.com


2 Systems

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


Previous: , Up: Systems   [Contents][Index]

2.1 cl-json-helper

Handy extras for cl-json

Author

Bob Felts <wrf3@stablecross.com>

License

BSD

Version

1.1.0

Dependency

cl-json (system).

Source

cl-json-helper.asd.

Child Components

3 Files

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


Previous: , Up: Files   [Contents][Index]

3.1 Lisp


Next: , Previous: , Up: Lisp   [Contents][Index]

3.1.1 cl-json-helper/cl-json-helper.asd

Source

cl-json-helper.asd.

Parent Component

cl-json-helper (system).

ASDF Systems

cl-json-helper.


3.1.2 cl-json-helper/package.lisp

Source

cl-json-helper.asd.

Parent Component

cl-json-helper (system).

Packages

cl-json-helper.


3.1.3 cl-json-helper/cl-json-helper.lisp

Dependency

package.lisp (file).

Source

cl-json-helper.asd.

Parent Component

cl-json-helper (system).

Public Interface
Internals

4 Packages

Packages are listed by definition order.


Previous: , Up: Packages   [Contents][Index]

4.1 cl-json-helper

Source

package.lisp.

Nickname

xjson

Use List

common-lisp.

Public Interface
Internals

5 Definitions

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


Next: , Previous: , Up: Definitions   [Contents][Index]

5.1 Public Interface


5.1.1 Ordinary functions

Function: json-bool (val)
Package

cl-json-helper.

Source

cl-json-helper.lisp.

Function: json-empty ()
Package

cl-json-helper.

Source

cl-json-helper.lisp.

Function: json-key-value (key list &key test)
Package

cl-json-helper.

Source

cl-json-helper.lisp.

Function: value-of (list &rest keys)
Package

cl-json-helper.

Source

cl-json-helper.lisp.


5.1.2 Standalone methods

Method: encode-json ((object json-false-obj) &optional stream)
Package

json.

Source

cl-json-helper.lisp.


5.2 Internals


Next: , Previous: , Up: Internals   [Contents][Index]

5.2.1 Special variables

Special Variable: *json-empty-obj*
Package

cl-json-helper.

Source

cl-json-helper.lisp.

Special Variable: *json-false-obj*
Package

cl-json-helper.

Source

cl-json-helper.lisp.


Next: , Previous: , Up: Internals   [Contents][Index]

5.2.2 Ordinary functions

Function: value-of-helper (list keys)
Package

cl-json-helper.

Source

cl-json-helper.lisp.


5.2.3 Classes

Class: json-empty-obj
Package

cl-json-helper.

Source

cl-json-helper.lisp.

Class: json-false-obj
Package

cl-json-helper.

Source

cl-json-helper.lisp.

Direct methods

encode-json.


Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts