The jsown-utils Reference Manual

Table of Contents

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

The jsown-utils Reference Manual

This is the jsown-utils Reference Manual, version 0.0.1, generated automatically by Declt version 3.0 "Montgomery Scott" on Sun May 15 05:06:14 2022 GMT+0.


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

1 Introduction

jsown-utils

jsown-utils is utilities for Common Lisp JSON library jsown, to pretty print JSON and so on.


License

Copyright(c) 2017 Muyinliu Xing Released under the ISC License.


Dependencies


Install and load with QuickLisp

In shell:

git clone https://github.com/muyinliu/jsown-utils.git
cp -r jsown-utils ~/quicklisp/local-projects/jsown-utils

Then in Common Lisp:

(ql:quickload 'jsown-utils)

Usage

pretty print utils

jsown:pprint-json, pretty print JSON

(jsown:pprint-json "{\"HeWeather5\":[{\"basic\":{\"city\":\"北京\",\"cnty\":\"中国\",\"id\":\"CN101010100\",\"lat\":\"39.904000\",\"lon\":\"116.391000\",\"update\":{\"loc\":\"2017-03-21 08:51\",\"utc\":\"2017-03-21 00:51\"}},\"now\":{\"cond\":{\"code\":\"101\",\"txt\":\"多云\"},\"fl\":\"0\",\"hum\":\"73\",\"pcpn\":\"0\",\"pres\":\"1027\",\"tmp\":\"6\",\"vis\":\"7\",\"wind\":{\"deg\":\"350\",\"dir\":\"东北风\",\"sc\":\"4-5\",\"spd\":\"18\"}},\"status\":\"ok\"}]}")
{
    "HeWeather5": [
        {
            "basic": {
                "city": "北京",
                "cnty": "中国",
                "id": "CN101010100",
                "lat": "39.904000",
                "lon": "116.391000",
                "update": {
                    "loc": "2017-03-21 08:51",
                    "utc": "2017-03-21 00:51"
                }
            },
            "now": {
                "cond": {
                    "code": "101",
                    "txt": "多云"
                },
                "fl": "0",
                "hum": "73",
                "pcpn": "0",
                "pres": "1027",
                "tmp": "6",
                "vis": "7",
                "wind": {
                    "deg": "350",
                    "dir": "东北风",
                    "sc": "4-5",
                    "spd": "18"
                }
            },
            "status": "ok"
        }
    ]
}
; No value

jsown:pretty-json, pretty JSON

Make JSON much more readable by add some newline or indent.

(jsown:pretty-json "{\"HeWeather5\":[{\"basic\":{\"city\":\"北京\",\"cnty\":\"中国\",\"id\":\"CN101010100\",\"lat\":\"39.904000\",\"lon\":\"116.391000\",\"update\":{\"loc\":\"2017-03-21 08:51\",\"utc\":\"2017-03-21 00:51\"}},\"now\":{\"cond\":{\"code\":\"101\",\"txt\":\"多云\"},\"fl\":\"0\",\"hum\":\"73\",\"pcpn\":\"0\",\"pres\":\"1027\",\"tmp\":\"6\",\"vis\":\"7\",\"wind\":{\"deg\":\"350\",\"dir\":\"东北风\",\"sc\":\"4-5\",\"spd\":\"18\"}},\"status\":\"ok\"}]}")
"{
    \"HeWeather5\": [
        {
            \"basic\": {
                \"city\": \"北京\",
                \"cnty\": \"中国\",
                \"id\": \"CN101010100\",
                \"lat\": \"39.904000\",
                \"lon\": \"116.391000\",
                \"update\": {
                    \"loc\": \"2017-03-21 08:51\",
                    \"utc\": \"2017-03-21 00:51\"
                }
            },
            \"now\": {
                \"cond\": {
                    \"code\": \"101\",
                    \"txt\": \"多云\"
                },
                \"fl\": \"0\",
                \"hum\": \"73\",
                \"pcpn\": \"0\",
                \"pres\": \"1027\",
                \"tmp\": \"6\",
                \"vis\": \"7\",
                \"wind\": {
                    \"deg\": \"350\",
                    \"dir\": \"东北风\",
                    \"sc\": \"4-5\",
                    \"spd\": \"18\"
                }
            },
            \"status\": \"ok\"
        }
    ]
}"

accessor utils

jsown:json-val, get value from JSON with key

(jsown:json-val (jsown:parse "{\"key1\":\"value1\",\"key2\":2}") "key1")

=>

"value1"

jsown:json-vals, get value from JSON object with keys(JavaScript style)

(jsown:json-vals (jsown:parse "{\"key1\":{\"key1.1\":\"value1.1\"},\"key2\":2}") 
                     "key1" "key1.1")

=>

"value1.1"

jsown:json-update-in, update value of JSON object with keys(JavaScript style)

(defvar *json* (jsown:parse "{\"key1\":{\"key1.1\":\"value1.1\"},\"key2\":2}"))
(jsown:json-update-in *json* ("key1" "key1.1") "new-value1.1")

=>

"new-value1.1"
*json*

=>

(:OBJ ("key1" :OBJ ("key1.1" . "new-value1.1")) ("key2" . 2))


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 jsown-utils

Author

Muyinliu Xing <muyinliu@gmail.com>

License

MIT

Description

Utilities for Common Lisp JSON library jsown

Version

0.0.1

Dependency

jsown

Source

jsown-utils.asd (file)

Components

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 jsown-utils/src

Parent

jsown-utils (system)

Location

src/

Component

jsown-utils.lisp (file)


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

4 Files

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


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

4.1 Lisp


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

4.1.1 jsown-utils.asd

Location

jsown-utils.asd

Systems

jsown-utils (system)


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

4.1.2 jsown-utils/src/jsown-utils.lisp

Parent

src (module)

Location

src/jsown-utils.lisp


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

4.2 Static


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

4.2.1 jsown-utils/jsown-utils.asd

Parent

jsown-utils (system)

Location

jsown-utils.asd


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

Appendix A Indexes


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

A.1 Concepts

Jump to:   F   J   L   M   S  
Index Entry  Section

F
File, Lisp, jsown-utils.asd: The jsown-utils․asd file
File, Lisp, jsown-utils/src/jsown-utils.lisp: The jsown-utils/src/jsown-utils․lisp file
File, static, jsown-utils/jsown-utils.asd: The jsown-utils/jsown-utils․asd file

J
jsown-utils.asd: The jsown-utils․asd file
jsown-utils/jsown-utils.asd: The jsown-utils/jsown-utils․asd file
jsown-utils/src: The jsown-utils/src module
jsown-utils/src/jsown-utils.lisp: The jsown-utils/src/jsown-utils․lisp file

L
Lisp File, jsown-utils.asd: The jsown-utils․asd file
Lisp File, jsown-utils/src/jsown-utils.lisp: The jsown-utils/src/jsown-utils․lisp file

M
Module, jsown-utils/src: The jsown-utils/src module

S
Static File, jsown-utils/jsown-utils.asd: The jsown-utils/jsown-utils․asd file

Jump to:   F   J   L   M   S  

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

A.2 Functions


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

A.3 Variables


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

A.4 Data types

Jump to:   J   S  
Index Entry  Section

J
jsown-utils: The jsown-utils system

S
System, jsown-utils: The jsown-utils system

Jump to:   J   S