The jonathan Reference Manual

Table of Contents

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

The jonathan Reference Manual

This is the jonathan Reference Manual, version 0.1, generated automatically by Declt version 2.3 "Robert April" on Wed Mar 14 04:05:38 2018 GMT+0.


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

1 Introduction

Jonathan

Build Status Build Status Coverage Status Quicklisp dist

JSON encoder and decoder.
It's faster than jsown - high performance Common Lisp json parser.

See Document.
This HTML is generated by Codex.

Usage

(to-json '(:name "Common Lisp" :born 1984 :impls (SBCL KCL)))
;; => "{\"NAME\":\"Common Lisp\",\"BORN\":1984,\"IMPLS\":[\"SBCL\",\"KCL\"]}"

(to-json '(:name "Common Lisp" :born 1984 :impls (SBCL KCL))
         :octets t)
;; => #(123 34 78 65 77 69 34 58 34 67 111 109 109 111 110 32 76 ...)

(to-json '((:name . "Common Lisp") (:born . 1984) (:impls SBCL KCL))
         :from :alist)
;; => "{\"NAME\":\"Common Lisp\",\"BORN\":1984,\"IMPLS\":[\"SBCL\",\"KCL\"]}"

(to-json '(:obj (:name . "Common Lisp") (:born . 1984) (:impls SBCL KCL))
         :from :jsown)
;; => "{\"NAME\":\"Common Lisp\",\"BORN\":1984,\"IMPLS\":[\"SBCL\",\"KCL\"]}"

(let ((encoder (compile-encoder (:from :alist) (name)
                 `(("name" . ,name)))))
  (funcall encoder "Rudolph"))
;; => "{\"name\":\"Rudolph\"}"

(parse "{\"NAME\":\"Common Lisp\",\"BORN\":1984,\"IMPLS\":[\"SBCL\",\"KCL\"]}")
;; => (:NAME "Common Lisp" :BORN 1984 :IMPLS ("SBCL" "CCL" "KCL"))

(parse "{\"NAME\":\"Common Lisp\",\"BORN\":1984,\"IMPLS\":[\"SBCL\",\"KCL\"]}"
       :as :alist)
;; => (("NAME" . "Common Lisp") ("BORN" . 1984) ("IMPLS" "SBCL" "CCL" "KCL"))

(parse "{\"NAME\":\"Common Lisp\",\"BORN\":1984,\"IMPLS\":[\"SBCL\",\"KCL\"]}"
       :as :jsown)
;; => (:obj ("NAME" . "Common Lisp") ("BORN" . 1984) ("IMPLS" "SBCL" "CCL" "KCL"))

(parse "{\"NAME\":\"Common Lisp\",\"BORN\":1984,\"IMPLS\":[\"SBCL\",\"KCL\"]}"
       :as :hash-table)
;; => #<HASH-TABLE :TEST EQUAL :COUNT 3>

Installasion

(ql:quickload :jonathan)

to-json

;; Restricted Property List Samples
(to-json '(:name :age :born :impls))
;; => "{\"NAME\":\"AGE\",\"BORN\":\"IMPLS\"}"
;; not "[\"NAME\",\"AGE\",\"BORN\",\"IMPLS\"]"

(to-json '(:name "Common Lisp" :born))
;; => "{\"NAME\":\"Common Lisp\",\"BORN\":[]}"
(defclass user ()
  ((id :type integer :initarg :id)
   (name :type string :initarg :name)))

(defmethod %to-json ((user user))
  (with-object
    (write-key-value "id" (slot-value user 'id))
    (write-key-value "name" (slot-value user 'name))))

(to-json (make-instance 'user :id 1 :name "Rudolph"))
;; => "{\"id\":1,\"name\":\"Rudolph\"}"

Benchmark of to-json

(let ((post (compile-encoder () (text)
               (list :|channel| "lisp-alien"
                     :|username| "alien-bot"
                     :|text| text
                     :|icon_url| "http://www.lisperati.com/lisplogo_warning2_256.png"))))
  (time
   (dotimes (_ 100000)
     (funcall post "Post from Alien!"))))
;; => 0.095

(flet ((post (text)
         (jonathan:to-json
               (list :|channel| "lisp-alien"
                     :|username| "alien-bot"
                     :|text| text
                     :|icon_url| "http://www.lisperati.com/lisplogo_warning2_256.png"))))
  (time
   (dotimes (_ 100000)
     (post "Post from Alien!"))))
;; => 0.095

(flet ((post (text)
         (format nil "{\"channel\":\"lisp-alien\",\"username\":\"alien-bot\",\"text\":~s,\"icon_url\":\"http://www.lisperati.com/lisplogo_warning2_256.png\"}" text)))
  (time
   (dotimes (_ 100000)
     (post "Post from Alien!"))))"\"}"))))
;; => 0.146

(flet ((post (text)
         (jonathan:to-json
               (list :|channel| "lisp-alien"
                     :|username| "alien-bot"
                     :|text| text
                     :|icon_url| "http://www.lisperati.com/lisplogo_warning2_256.png"))))
  (time
   (dotimes (_ 100000)
     (post "Post from Alien!"))))
;; => 0.604 - without compiler-macro.

(flet ((post (text)
         (jsown:to-json
          `(:obj (:|channel| . "lisp-alien")
                 (:|username| . "alien-bot")
                 (:|text| . ,text)
                 (:|icon_url| . "http://www.lisperati.com/lisplogo_warning2_256.png")))))
  (time
   (dotimes (_ 100000)
     (post "Post from Alien!"))))
;; => 1.117

parse

(parse "{\"key\":\"value\"}")
;; => (:|key| "value")

(parse "{\"key\":\"value\"")
;; => raise <jonathan-unexpected-eof>.

(parse "{\"key\":\"value\"" :junk-allowed t)
;; => (:|key| "value")

(let ((*null-value* :null)
      (*false-value* :false)
      (*empty-array-value* :[]))
  (parse "{\"null\":null,\"false\":false,\"empty\":[]}"))
;; => (:|null| :NULL :|false| :FALSE :|empty| :[])

(parse "{\"key1\":\"value1\",\"key2\":\"value2\"}" :keywords-to-read '("key1"))
;; => (:|key1| "value1")

(flet ((normalizer (key)
         (with-vector-parsing (key)
           (match-i-case
             ("key1" (return-from normalizer "other-key1"))
             ("key2" (return-from normalizer "other-key2"))
             (otherwise (return-from normalizer nil))))))
  (parse "{\"KEY1\":{\"key2\":\"value2\"},\"key3\":\"value3\"}"
         :keyword-normalizer #'normalizer)
;; => (:|other-key1| (:|key2| "value2"))
  (parse "{\"KEY1\":{\"key2\":\"value2\"},\"key3\":\"value3\"}"
         :keyword-normalizer #'normalizer
         :normalize-all t))
;; => (:|other-key1| (:|other-key2| "value2"))

(parse "\"\\u30b8\\u30e7\\u30ca\\u30b5\\u30f3\"")
;; => "ジョナサン"

(parse "\"\\uD840\\uDC0B\"")
;; => "𠀋"

(parse "\"\\u30b8\\u30e7\\u30ca\\u30b5\\u30f3\""
       :unescape-unicode-escape-sequence nil)
;; => "\u30b8\u30e7\u30ca\u30b5\u30f3"

Benchmark of parse

(let ((s "{\"key1\":\"value\",\"key2\":1.1,\"key3\":[\"Hello\",1.2]}"))
  (time
   (dotimes (_ 100000)
     (jonathan:parse s :as :alist))))
;; => 0.174

(let ((s "{\"key1\":\"value\",\"key2\":1.1,\"key3\":[\"Hello\",1.2]}"))
  (time
   (dotimes (_ 100000)
     (jonathan:parse s :as :jsown))))
;; => 0.181

(let ((s "{\"key1\":\"value\",\"key2\":1.1,\"key3\":[\"Hello\",1.2]}"))
  (time
   (dotimes (_ 100000)
     (jsown:parse s))))
;; => 0.204

Benchmark of parse partially

(let ((s "{\"key1\":\"value\",\"key2\":1.1,\"key3\":[\"Hello\",1.2]}"))
  (time
   (dotimes (_ 100000)
     (jonathan:parse s :as :alist :keywords-to-read '("key1")))))
;; => 0.065

(let ((s "{\"key1\":\"value\",\"key2\":1.1,\"key3\":[\"Hello\",1.2]}"))
  (time
   (dotimes (_ 100000)
     (jonathan:parse s :as :jsown :keywords-to-read '("key1")))))
;; => 0.069

(let ((s "{\"key1\":\"value\",\"key2\":1.1,\"key3\":[\"Hello\",1.2]}"))
  (time
   (dotimes (_ 100000)
     (jsown:parse s "key1"))))
;; => 0.085

Helper

compile-encoder

(compile-encoder () (name)
  (list :name name))
;; => #<FUNCTION (LAMBDA (name))>

(funcall * "Rudolph")
;; => "{\"NAME\":\"Rudolph\"}"

(compile-encoder (:from :alist) (name)
  `(("name" . ,name)))
;; => #<FUNCTION (LAMBDA (name))>

(funcall * "Rudolph")
;; => "{\"name\":\"Rudolph\"}"

(compile-encoder (:octets t) (name)
  (list :name name))
;; => #<FUNCTION (LAMBDA (name))>

(funcall * "Rudolph")
;; => #(123 34 75 69 89 49 ...)

with-object

(defclass user ()
  ((id :initarg :id)
   (name :initarg :name)))
   
(defmethod %to-json ((user user))
  (with-object
    (write-key "id")
    (write-value (slot-value user 'id))
    (write-key-value "name" (slot-value user 'name))))

(to-json (make-instance 'user :id 1 :name "Rudolph"))
;; => "{\"id\":1,\"name\":\"Rudolph\"}"

with-array

(defclass user ()
  ((id :initarg :id)
   (name :initarg :name)))
   
(defmethod %to-json ((user user))
  (with-array
    (write-item "id")
    (write-item (slot-value user 'id))
    (write-item "name")
    (write-item (slot-value user 'name))))

(to-json (make-instance 'user :id 1 :name "Rudolph"))
;; => "[\"id\",1,\"name\",\"Rudolph\"]"

with-output

(with-output-to-string (stream)
  (with-output (stream)
    (with-object
      (write-key-value "key" "value"))))
;; => "{\"key\":\"value\"}"

with-output-to-string*

(with-output-to-string*
  (with-object
    (write-key-value "key" "value"))))
;; => "{\"key\":\"value\"}"

See Also

Author

Copyright

Copyright (c) 2015 Ru


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

2 Systems

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


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

2.1 jonathan

Author

Rudolph-Miller

License

MIT

Description

High performance JSON encoder and decoder. Currently support: SBCL, CCL.

Long Description

# Jonathan

[![Build Status](https://circleci.com/gh/Rudolph-Miller/jonathan.svg?style=shield)](https://circleci.com/gh/Rudolph-Miller/jonathan)
[![Build Status](https://travis-ci.org/Rudolph-Miller/jonathan.svg?branch=master)](https://travis-ci.org/Rudolph-Miller/jonathan)
[![Coverage Status](https://coveralls.io/repos/Rudolph-Miller/jonathan/badge.svg?branch=master)](https://coveralls.io/r/Rudolph-Miller/jonathan?branch=master) [![Quicklisp dist](http://quickdocs.org/badge/jonathan.svg)](http://quickdocs.org/jonathan/)

JSON encoder and decoder.
It’s faster than [jsown](https://github.com/madnificent/jsown) - high performance Common Lisp json parser.

See [Document](http://rudolph-miller.github.io/jonathan/overview.html).
This HTML is generated by [Codex](https://github.com/CommonDoc/codex).

## Usage

“‘Lisp
(to-json ’(:name "Common Lisp" :born 1984 :impls (SBCL KCL)))
;; => "{\"NAME\":\"Common Lisp\",\"BORN\":1984,\"IMPLS\":[\"SBCL\",\"KCL\"]}"

(to-json ’(:name "Common Lisp" :born 1984 :impls (SBCL KCL))
:octets t)
;; => #(123 34 78 65 77 69 34 58 34 67 111 109 109 111 110 32 76 ...)

(to-json ’((:name . "Common Lisp") (:born . 1984) (:impls SBCL KCL))
:from :alist)
;; => "{\"NAME\":\"Common Lisp\",\"BORN\":1984,\"IMPLS\":[\"SBCL\",\"KCL\"]}"

(to-json ’(:obj (:name . "Common Lisp") (:born . 1984) (:impls SBCL KCL))
:from :jsown)
;; => "{\"NAME\":\"Common Lisp\",\"BORN\":1984,\"IMPLS\":[\"SBCL\",\"KCL\"]}"

(let ((encoder (compile-encoder (:from :alist) (name)
‘(("name" . ,name)))))
(funcall encoder "Rudolph"))
;; => "{\"name\":\"Rudolph\"}"

(parse "{\"NAME\":\"Common Lisp\",\"BORN\":1984,\"IMPLS\":[\"SBCL\",\"KCL\"]}")
;; => (:NAME "Common Lisp" :BORN 1984 :IMPLS ("SBCL" "CCL" "KCL"))

(parse "{\"NAME\":\"Common Lisp\",\"BORN\":1984,\"IMPLS\":[\"SBCL\",\"KCL\"]}"
:as :alist)
;; => (("NAME" . "Common Lisp") ("BORN" . 1984) ("IMPLS" "SBCL" "CCL" "KCL"))

(parse "{\"NAME\":\"Common Lisp\",\"BORN\":1984,\"IMPLS\":[\"SBCL\",\"KCL\"]}"
:as :jsown)
;; => (:obj ("NAME" . "Common Lisp") ("BORN" . 1984) ("IMPLS" "SBCL" "CCL" "KCL"))

(parse "{\"NAME\":\"Common Lisp\",\"BORN\":1984,\"IMPLS\":[\"SBCL\",\"KCL\"]}"
:as :hash-table)
;; => #<HASH-TABLE :TEST EQUAL :COUNT 3>
“‘

## Installasion

“‘Lisp
(ql:quickload :jonathan)
“‘

## to-json
- can encode Object into JSON format.
- Restricted Property List. (‘:from :plist‘)
- Association List. (‘:from :alist‘)
- Jsown Object. (‘:from :jsown‘)
- can return not only string but also octets.
- can be compiled by compiler-macro.

“‘Lisp
;; Restricted Property List Samples
(to-json ’(:name :age :born :impls))
;; => "{\"NAME\":\"AGE\",\"BORN\":\"IMPLS\"}"
;; not "[\"NAME\",\"AGE\",\"BORN\",\"IMPLS\"]"

(to-json ’(:name "Common Lisp" :born))
;; => "{\"NAME\":\"Common Lisp\",\"BORN\":[]}"
“‘

- is customizable by ‘%to-json‘, ‘%write-char‘ and ‘%write-string‘.

“‘Lisp
(defclass user ()
((id :type integer :initarg :id)
(name :type string :initarg :name)))

(defmethod %to-json ((user user))
(with-object
(write-key-value "id" (slot-value user ’id))
(write-key-value "name" (slot-value user ’name))))

(to-json (make-instance ’user :id 1 :name "Rudolph"))
;; => "{\"id\":1,\"name\":\"Rudolph\"}"
“‘

![Benchmark of to-json](./images/1.to-json.png)

“‘Lisp
(let ((post (compile-encoder () (text)
(list :|channel| "lisp-alien"
:|username| "alien-bot"
:|text| text
:|icon_url| "http://www.lisperati.com/lisplogo_warning2_256.png"))))
(time
(dotimes (_ 100000)
(funcall post "Post from Alien!"))))
;; => 0.095

(flet ((post (text)
(jonathan:to-json
(list :|channel| "lisp-alien"
:|username| "alien-bot"
:|text| text
:|icon_url| "http://www.lisperati.com/lisplogo_warning2_256.png"))))
(time
(dotimes (_ 100000)
(post "Post from Alien!"))))
;; => 0.095

(flet ((post (text)
(format nil "{\"channel\":\"lisp-alien\",\"username\":\"alien-bot\",\"text\":~s,\"icon_url\":\"http://www.lisperati.com/lisplogo_warning2_256.png\"}" text))) (time
(dotimes (_ 100000)
(post "Post from Alien!"))))"\"}"))))
;; => 0.146

(flet ((post (text)
(jonathan:to-json
(list :|channel| "lisp-alien"
:|username| "alien-bot"
:|text| text
:|icon_url| "http://www.lisperati.com/lisplogo_warning2_256.png"))))
(time
(dotimes (_ 100000)
(post "Post from Alien!"))))
;; => 0.604 - without compiler-macro.

(flet ((post (text)
(jsown:to-json
‘(:obj (:|channel| . "lisp-alien")
(:|username| . "alien-bot")
(:|text| . ,text)
(:|icon_url| . "http://www.lisperati.com/lisplogo_warning2_256.png")))))
(time
(dotimes (_ 100000)
(post "Post from Alien!"))))
;; => 1.117
“‘

## parse
- can decode JSON format string into Object.
- Property List. (‘:as :plist‘)
- Association List. (‘:as :alist‘)
- Json Object. (‘:as :jsown‘)
- Hash Table. (‘:as :hash-table‘)
- can allow junked JSON format string (‘:junk-allowed t‘)
- can customize ‘*null-value*‘, ‘*false-value*‘ and ‘*empty-array-value*‘.
- can restrict keywords to read. (‘:keywords-to-read‘)
- can normalize keywords. (‘:keyword-normalizer‘)
- can not normalize keywords in nested objects.
- can ignore keywords when normalizer returns NIL.
- can unescape unicode escape sequences. (‘:unescape-unicode-escape-sequence‘)

“‘Lisp
(parse "{\"key\":\"value\"}")
;; => (:|key| "value")

(parse "{\"key\":\"value\"")
;; => raise <jonathan-unexpected-eof>.

(parse "{\"key\":\"value\"" :junk-allowed t)
;; => (:|key| "value")

(let ((*null-value* :null)
(*false-value* :false)
(*empty-array-value* :[]))
(parse "{\"null\":null,\"false\":false,\"empty\":[]}"))
;; => (:|null| :NULL :|false| :FALSE :|empty| :[])

(parse "{\"key1\":\"value1\",\"key2\":\"value2\"}" :keywords-to-read ’("key1"))
;; => (:|key1| "value1")

(flet ((normalizer (key)
(with-vector-parsing (key)
(match-i-case
("key1" (return-from normalizer "other-key1"))
("key2" (return-from normalizer "other-key2"))
(otherwise (return-from normalizer nil))))))
(parse "{\"KEY1\":{\"key2\":\"value2\"},\"key3\":\"value3\"}"
:keyword-normalizer #’normalizer)
;; => (:|other-key1| (:|key2| "value2"))
(parse "{\"KEY1\":{\"key2\":\"value2\"},\"key3\":\"value3\"}"
:keyword-normalizer #’normalizer
:normalize-all t))
;; => (:|other-key1| (:|other-key2| "value2"))

(parse "\"\\u30b8\\u30e7\\u30ca\\u30b5\\u30f3\"")
;; => "ジョナサン"

(parse "\"\\uD840\\uDC0B\"")
;; => "𠀋"

(parse "\"\\u30b8\\u30e7\\u30ca\\u30b5\\u30f3\""
:unescape-unicode-escape-sequence nil)
;; => "\u30b8\u30e7\u30ca\u30b5\u30f3"
“‘

![Benchmark of parse](./images/2.parse.png)

“‘Lisp
(let ((s "{\"key1\":\"value\",\"key2\":1.1,\"key3\":[\"Hello\",1.2]}"))
(time
(dotimes (_ 100000)
(jonathan:parse s :as :alist))))
;; => 0.174

(let ((s "{\"key1\":\"value\",\"key2\":1.1,\"key3\":[\"Hello\",1.2]}"))
(time
(dotimes (_ 100000)
(jonathan:parse s :as :jsown))))
;; => 0.181

(let ((s "{\"key1\":\"value\",\"key2\":1.1,\"key3\":[\"Hello\",1.2]}"))
(time
(dotimes (_ 100000)
(jsown:parse s))))
;; => 0.204
“‘

![Benchmark of parse partially](./images/3.parse-partially.png)

“‘Lisp
(let ((s "{\"key1\":\"value\",\"key2\":1.1,\"key3\":[\"Hello\",1.2]}"))
(time
(dotimes (_ 100000)
(jonathan:parse s :as :alist :keywords-to-read ’("key1")))))
;; => 0.065

(let ((s "{\"key1\":\"value\",\"key2\":1.1,\"key3\":[\"Hello\",1.2]}"))
(time
(dotimes (_ 100000)
(jonathan:parse s :as :jsown :keywords-to-read ’("key1")))))
;; => 0.069

(let ((s "{\"key1\":\"value\",\"key2\":1.1,\"key3\":[\"Hello\",1.2]}"))
(time
(dotimes (_ 100000)
(jsown:parse s "key1"))))
;; => 0.085
“‘

## Helper

### compile-encoder

- can compile encoder.

“‘Lisp
(compile-encoder () (name)
(list :name name))
;; => #<FUNCTION (LAMBDA (name))>

(funcall * "Rudolph")
;; => "{\"NAME\":\"Rudolph\"}"

(compile-encoder (:from :alist) (name)
‘(("name" . ,name)))
;; => #<FUNCTION (LAMBDA (name))>

(funcall * "Rudolph")
;; => "{\"name\":\"Rudolph\"}"

(compile-encoder (:octets t) (name)
(list :name name))
;; => #<FUNCTION (LAMBDA (name))>

(funcall * "Rudolph")
;; => #(123 34 75 69 89 49 ...)
“‘

### with-object

“‘Lisp
(defclass user ()
((id :initarg :id)
(name :initarg :name)))

(defmethod %to-json ((user user))
(with-object
(write-key "id")
(write-value (slot-value user ’id))
(write-key-value "name" (slot-value user ’name))))

(to-json (make-instance ’user :id 1 :name "Rudolph"))
;; => "{\"id\":1,\"name\":\"Rudolph\"}"
“‘

### with-array

“‘Lisp
(defclass user ()
((id :initarg :id)
(name :initarg :name)))

(defmethod %to-json ((user user))
(with-array
(write-item "id")
(write-item (slot-value user ’id))
(write-item "name")
(write-item (slot-value user ’name))))

(to-json (make-instance ’user :id 1 :name "Rudolph"))
;; => "[\"id\",1,\"name\",\"Rudolph\"]"
“‘

### with-output

“‘Lisp
(with-output-to-string (stream)
(with-output (stream)
(with-object
(write-key-value "key" "value"))))
;; => "{\"key\":\"value\"}"
“‘

### with-output-to-string*

“‘Lisp
(with-output-to-string*
(with-object
(write-key-value "key" "value"))))
;; => "{\"key\":\"value\"}"
“‘

## See Also
- [proc-parse](https://github.com/fukamachi/proc-parse)

## Author

- Rudolph-Miller

## Copyright

Copyright (c) 2015 Rudolph-Miller

Version

0.1

Dependencies
Source

jonathan.asd (file)

Component

src (module)


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

3 Modules

Modules are listed depth-first from the system components tree.


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

3.1 jonathan/src

Parent

jonathan (system)

Location

src/

Components

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

4 Files

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


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

4.1 Lisp


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

4.1.1 jonathan.asd

Location

jonathan.asd

Systems

jonathan (system)

Packages

jonathan-asd


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

4.1.2 jonathan/src/jonathan.lisp

Dependencies
Parent

src (module)

Location

src/jonathan.lisp

Packages

jonathan


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

4.1.3 jonathan/src/helper.lisp

Dependencies
Parent

src (module)

Location

src/helper.lisp

Packages

jonathan.helper

Exported Definitions
Internal Definitions

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

4.1.4 jonathan/src/encode.lisp

Dependencies
Parent

src (module)

Location

src/encode.lisp

Packages

jonathan.encode

Exported Definitions
Internal Definitions

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

4.1.5 jonathan/src/decode.lisp

Dependency

util.lisp (file)

Parent

src (module)

Location

src/decode.lisp

Packages

jonathan.decode

Exported Definitions
Internal Definitions

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

4.1.6 jonathan/src/util.lisp

Dependency

error.lisp (file)

Parent

src (module)

Location

src/util.lisp

Packages

jonathan.util

Exported Definitions

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

4.1.7 jonathan/src/error.lisp

Parent

src (module)

Location

src/error.lisp

Packages

jonathan.error

Exported Definitions

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

5 Packages

Packages are listed by definition order.


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

5.1 jonathan-asd

Source

jonathan.asd

Use List

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

5.2 jonathan

Source

jonathan.lisp (file)

Nickname

jojo

Use List

common-lisp


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

5.3 jonathan.helper

Source

helper.lisp (file)

Use List
Exported Definitions
Internal Definitions

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

5.4 jonathan.encode

Source

encode.lisp (file)

Use List
Used By List

jonathan.helper

Exported Definitions
Internal Definitions

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

5.5 jonathan.decode

Source

decode.lisp (file)

Use List
Exported Definitions
Internal Definitions

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

5.6 jonathan.util

Source

util.lisp (file)

Use List
Used By List
Exported Definitions

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

5.7 jonathan.error

Source

error.lisp (file)

Use List

common-lisp

Used By List
Exported Definitions

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

6 Definitions

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


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

6.1 Exported definitions


Next: , Previous: , Up: Exported definitions   [Contents][Index]

6.1.1 Special variables

Special Variable: *empty-array-value*

LISP value of [].

Package

jonathan.decode

Source

decode.lisp (file)

Special Variable: *empty-object-value*

LISP value of {}.

Package

jonathan.decode

Source

decode.lisp (file)

Special Variable: *false-value*

LISP value of false.

Package

jonathan.decode

Source

decode.lisp (file)

Special Variable: *from*

Default value of from used by #’to-json.

Package

jonathan.encode

Source

encode.lisp (file)

Special Variable: *null-value*

LISP value of null.

Package

jonathan.decode

Source

decode.lisp (file)

Special Variable: *octets*

Default value of octets used by #’to-json.

Package

jonathan.encode

Source

encode.lisp (file)

Special Variable: *quasiquote*
Package

jonathan.util

Source

util.lisp (file)

Special Variable: *stream*

Stream used by #’to-json.

Package

jonathan.encode

Source

encode.lisp (file)

Special Variable: +impl-comma-p+
Package

jonathan.util

Source

util.lisp (file)


Next: , Previous: , Up: Exported definitions   [Contents][Index]

6.1.2 Macros

Macro: compile-encoder (&key OCTETS FROM RETURN-FORM) (&rest ARGS) &body BODY

Compile encoder.

Package

jonathan.helper

Source

helper.lisp (file)

Macro: with-array &body BODY

Make writing array safe.

Package

jonathan.encode

Source

encode.lisp (file)

Macro: with-object &body BODY

Make writing object safe.

Package

jonathan.encode

Source

encode.lisp (file)

Macro: with-output (STREAM) &body BODY

Bind *stream* to stream.

Package

jonathan.encode

Source

encode.lisp (file)

Macro: with-output-to-string* &body BODY

Output *stream* as string.

Package

jonathan.helper

Source

helper.lisp (file)

Macro: write-item ITEM

Write item of array.

Package

jonathan.encode

Source

encode.lisp (file)

Macro: write-key KEY

Write key part of object.

Package

jonathan.encode

Source

encode.lisp (file)

Macro: write-key-value KEY VALUE

Write key and value of object.

Package

jonathan.encode

Source

encode.lisp (file)

Macro: write-value VALUE

Write value part of object.

Package

jonathan.encode

Source

encode.lisp (file)


Next: , Previous: , Up: Exported definitions   [Contents][Index]

6.1.3 Compiler macros

Compiler Macro: parse STRING &key AS JUNK-ALLOWED KEYWORDS-TO-READ KEYWORD-NORMALIZER NORMALIZE-ALL EXCLUDE-NORMALIZE-KEYS UNESCAPE-UNICODE-ESCAPE-SEQUENCE
Package

jonathan.decode

Source

decode.lisp (file)

Compiler Macro: to-json ARGS &key FROM OCTETS
Package

jonathan.encode

Source

helper.lisp (file)


Next: , Previous: , Up: Exported definitions   [Contents][Index]

6.1.4 Functions

Function: %write-char ()

Write character to *stream*.

Package

jonathan.encode

Source

encode.lisp (file)

Function: %write-string ()

Write string to *stream*.

Package

jonathan.encode

Source

encode.lisp (file)

Function: comma-expr COMMA
Package

jonathan.util

Source

util.lisp (file)

Function: comma-p COMMA
Package

jonathan.util

Source

util.lisp (file)

Function: integer-char-p CHAR
Package

jonathan.util

Source

util.lisp (file)

Function: make-keyword STR
Package

jonathan.util

Source

util.lisp (file)

Function: my-plist-p LIST
Package

jonathan.util

Source

util.lisp (file)

Function: parse ()

Convert JSON String to LISP object.

Package

jonathan.decode

Source

decode.lisp (file)

Function: to-json ()

Convert LISP object to JSON String.

Package

jonathan.encode

Source

encode.lisp (file)


Next: , Previous: , Up: Exported definitions   [Contents][Index]

6.1.5 Generic functions

Generic Function: %to-json OBJ

Write obj as JSON string.

Package

jonathan.encode

Source

encode.lisp (file)

Methods
Method: %to-json (_ (eql nil))
Method: %to-json (_ (eql empty))
Method: %to-json (_ (eql null))
Method: %to-json (_ (eql false))
Method: %to-json (_ (eql t))
Method: %to-json (SYMBOL symbol)
Method: %to-json (HASH hash-table)
Method: %to-json (VECTOR vector)
Method: %to-json (LIST list)
Method: %to-json (RATIO ratio)
Method: %to-json (FLOAT float)
Method: %to-json (NUMBER number)
Method: %to-json (STRING string)

Previous: , Up: Exported definitions   [Contents][Index]

6.1.6 Conditions

Condition: <jonathan-error> ()

Base condition of jonathan-errors.

Package

jonathan.error

Source

error.lisp (file)

Direct superclasses

simple-error (condition)

Direct subclasses
Condition: <jonathan-incomplete-json-error> ()

Incomplete JSON string error.

Package

jonathan.error

Source

error.lisp (file)

Direct superclasses

<jonathan-error> (condition)

Direct slots
Slot: object

Parsing objcet slot.

Initargs

:object

Condition: <jonathan-not-supported-error> ()
Package

jonathan.error

Source

error.lisp (file)

Direct superclasses

<jonathan-error> (condition)

Direct slots
Slot: object

Not supported object slot.

Initargs

:object

Condition: <jonathan-unexpected-eof-error> ()

Unexpecded EOF error.

Package

jonathan.error

Source

error.lisp (file)

Direct superclasses

<jonathan-error> (condition)

Direct slots
Slot: object

Parsing object slot.

Initargs

:object

Condition: <jonathan-without-tail-surrogate-error> ()
Package

jonathan.error

Source

error.lisp (file)

Direct superclasses

<jonathan-error> (condition)


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

6.2 Internal definitions


Next: , Previous: , Up: Internal definitions   [Contents][Index]

6.2.1 Special variables

Special Variable: *compile-encoder-prefix*
Package

jonathan.helper

Source

helper.lisp (file)

Special Variable: *inner-nest-p*
Package

jonathan.decode

Source

decode.lisp (file)


Next: , Previous: , Up: Internal definitions   [Contents][Index]

6.2.2 Macros

Macro: make-normalizer KEYWORDS
Package

jonathan.decode

Source

decode.lisp (file)

Macro: with-macro-p LIST
Package

jonathan.encode

Source

encode.lisp (file)


Previous: , Up: Internal definitions   [Contents][Index]

6.2.3 Functions

Function: alist-to-json ()
Package

jonathan.encode

Source

encode.lisp (file)

Function: check-args ARGS
Package

jonathan.helper

Source

helper.lisp (file)

Function: foldable-keywords-to-read-p KEYWORDS-TO-READ
Package

jonathan.decode

Source

decode.lisp (file)

Function: list-to-json ()
Package

jonathan.encode

Source

encode.lisp (file)

Function: normalize-form OBJECT
Package

jonathan.helper

Source

helper.lisp (file)

Function: plist-to-json ()
Package

jonathan.encode

Source

encode.lisp (file)

Function: replace-form-with-placeholders FORM
Package

jonathan.helper

Source

helper.lisp (file)

Function: string-to-json ()
Package

jonathan.encode

Source

encode.lisp (file)


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

Appendix A Indexes


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

A.1 Concepts

Jump to:   F   J   L   M  
Index Entry  Section

F
File, Lisp, jonathan.asd: The jonathan<dot>asd file
File, Lisp, jonathan/src/decode.lisp: The jonathan/src/decode<dot>lisp file
File, Lisp, jonathan/src/encode.lisp: The jonathan/src/encode<dot>lisp file
File, Lisp, jonathan/src/error.lisp: The jonathan/src/error<dot>lisp file
File, Lisp, jonathan/src/helper.lisp: The jonathan/src/helper<dot>lisp file
File, Lisp, jonathan/src/jonathan.lisp: The jonathan/src/jonathan<dot>lisp file
File, Lisp, jonathan/src/util.lisp: The jonathan/src/util<dot>lisp file

J
jonathan.asd: The jonathan<dot>asd file
jonathan/src: The jonathan/src module
jonathan/src/decode.lisp: The jonathan/src/decode<dot>lisp file
jonathan/src/encode.lisp: The jonathan/src/encode<dot>lisp file
jonathan/src/error.lisp: The jonathan/src/error<dot>lisp file
jonathan/src/helper.lisp: The jonathan/src/helper<dot>lisp file
jonathan/src/jonathan.lisp: The jonathan/src/jonathan<dot>lisp file
jonathan/src/util.lisp: The jonathan/src/util<dot>lisp file

L
Lisp File, jonathan.asd: The jonathan<dot>asd file
Lisp File, jonathan/src/decode.lisp: The jonathan/src/decode<dot>lisp file
Lisp File, jonathan/src/encode.lisp: The jonathan/src/encode<dot>lisp file
Lisp File, jonathan/src/error.lisp: The jonathan/src/error<dot>lisp file
Lisp File, jonathan/src/helper.lisp: The jonathan/src/helper<dot>lisp file
Lisp File, jonathan/src/jonathan.lisp: The jonathan/src/jonathan<dot>lisp file
Lisp File, jonathan/src/util.lisp: The jonathan/src/util<dot>lisp file

M
Module, jonathan/src: The jonathan/src module

Jump to:   F   J   L   M  

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

A.2 Functions

Jump to:   %  
A   C   F   G   I   L   M   N   P   R   S   T   W  
Index Entry  Section

%
%to-json: Exported generic functions
%to-json: Exported generic functions
%to-json: Exported generic functions
%to-json: Exported generic functions
%to-json: Exported generic functions
%to-json: Exported generic functions
%to-json: Exported generic functions
%to-json: Exported generic functions
%to-json: Exported generic functions
%to-json: Exported generic functions
%to-json: Exported generic functions
%to-json: Exported generic functions
%to-json: Exported generic functions
%to-json: Exported generic functions
%write-char: Exported functions
%write-string: Exported functions

A
alist-to-json: Internal functions

C
check-args: Internal functions
comma-expr: Exported functions
comma-p: Exported functions
compile-encoder: Exported macros
Compiler Macro, parse: Exported compiler macros
Compiler Macro, to-json: Exported compiler macros

F
foldable-keywords-to-read-p: Internal functions
Function, %write-char: Exported functions
Function, %write-string: Exported functions
Function, alist-to-json: Internal functions
Function, check-args: Internal functions
Function, comma-expr: Exported functions
Function, comma-p: Exported functions
Function, foldable-keywords-to-read-p: Internal functions
Function, integer-char-p: Exported functions
Function, list-to-json: Internal functions
Function, make-keyword: Exported functions
Function, my-plist-p: Exported functions
Function, normalize-form: Internal functions
Function, parse: Exported functions
Function, plist-to-json: Internal functions
Function, replace-form-with-placeholders: Internal functions
Function, string-to-json: Internal functions
Function, to-json: Exported functions

G
Generic Function, %to-json: Exported generic functions

I
integer-char-p: Exported functions

L
list-to-json: Internal functions

M
Macro, compile-encoder: Exported macros
Macro, make-normalizer: Internal macros
Macro, with-array: Exported macros
Macro, with-macro-p: Internal macros
Macro, with-object: Exported macros
Macro, with-output: Exported macros
Macro, with-output-to-string*: Exported macros
Macro, write-item: Exported macros
Macro, write-key: Exported macros
Macro, write-key-value: Exported macros
Macro, write-value: Exported macros
make-keyword: Exported functions
make-normalizer: Internal macros
Method, %to-json: Exported generic functions
Method, %to-json: Exported generic functions
Method, %to-json: Exported generic functions
Method, %to-json: Exported generic functions
Method, %to-json: Exported generic functions
Method, %to-json: Exported generic functions
Method, %to-json: Exported generic functions
Method, %to-json: Exported generic functions
Method, %to-json: Exported generic functions
Method, %to-json: Exported generic functions
Method, %to-json: Exported generic functions
Method, %to-json: Exported generic functions
Method, %to-json: Exported generic functions
my-plist-p: Exported functions

N
normalize-form: Internal functions

P
parse: Exported compiler macros
parse: Exported functions
plist-to-json: Internal functions

R
replace-form-with-placeholders: Internal functions

S
string-to-json: Internal functions

T
to-json: Exported compiler macros
to-json: Exported functions

W
with-array: Exported macros
with-macro-p: Internal macros
with-object: Exported macros
with-output: Exported macros
with-output-to-string*: Exported macros
write-item: Exported macros
write-key: Exported macros
write-key-value: Exported macros
write-value: Exported macros

Jump to:   %  
A   C   F   G   I   L   M   N   P   R   S   T   W  

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

A.3 Variables

Jump to:   *   +  
O   S  
Index Entry  Section

*
*compile-encoder-prefix*: Internal special variables
*empty-array-value*: Exported special variables
*empty-object-value*: Exported special variables
*false-value*: Exported special variables
*from*: Exported special variables
*inner-nest-p*: Internal special variables
*null-value*: Exported special variables
*octets*: Exported special variables
*quasiquote*: Exported special variables
*stream*: Exported special variables

+
+impl-comma-p+: Exported special variables

O
object: Exported conditions
object: Exported conditions
object: Exported conditions

S
Slot, object: Exported conditions
Slot, object: Exported conditions
Slot, object: Exported conditions
Special Variable, *compile-encoder-prefix*: Internal special variables
Special Variable, *empty-array-value*: Exported special variables
Special Variable, *empty-object-value*: Exported special variables
Special Variable, *false-value*: Exported special variables
Special Variable, *from*: Exported special variables
Special Variable, *inner-nest-p*: Internal special variables
Special Variable, *null-value*: Exported special variables
Special Variable, *octets*: Exported special variables
Special Variable, *quasiquote*: Exported special variables
Special Variable, *stream*: Exported special variables
Special Variable, +impl-comma-p+: Exported special variables

Jump to:   *   +  
O   S  

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

A.4 Data types

Jump to:   <  
C   J   P   S  
Index Entry  Section

<
<jonathan-error>: Exported conditions
<jonathan-incomplete-json-error>: Exported conditions
<jonathan-not-supported-error>: Exported conditions
<jonathan-unexpected-eof-error>: Exported conditions
<jonathan-without-tail-surrogate-error>: Exported conditions

C
Condition, <jonathan-error>: Exported conditions
Condition, <jonathan-incomplete-json-error>: Exported conditions
Condition, <jonathan-not-supported-error>: Exported conditions
Condition, <jonathan-unexpected-eof-error>: Exported conditions
Condition, <jonathan-without-tail-surrogate-error>: Exported conditions

J
jonathan: The jonathan system
jonathan: The jonathan package
jonathan-asd: The jonathan-asd package
jonathan.decode: The jonathan<dot>decode package
jonathan.encode: The jonathan<dot>encode package
jonathan.error: The jonathan<dot>error package
jonathan.helper: The jonathan<dot>helper package
jonathan.util: The jonathan<dot>util package

P
Package, jonathan: The jonathan package
Package, jonathan-asd: The jonathan-asd package
Package, jonathan.decode: The jonathan<dot>decode package
Package, jonathan.encode: The jonathan<dot>encode package
Package, jonathan.error: The jonathan<dot>error package
Package, jonathan.helper: The jonathan<dot>helper package
Package, jonathan.util: The jonathan<dot>util package

S
System, jonathan: The jonathan system

Jump to:   <  
C   J   P   S