Home

Awesome

json-pointer.el

JSON pointer implementation in Emacs Lisp. This is inspired by JSON::Pointer and Mojo::JSON::Pointer

API

(json-pointer-get json path)

Get element by path. json is decoded object by json.el.

Sample code

(let ((json '((foo . 1)
              (bar . [((qux . "hello")) 3])
              (baz . ((boo . [1 3 5 7]))))))
    (json-pointer-get json "/foo")        ;; => 1
    (json-pointer-get json "/bar/0")      ;; =>  '((qux . "hello"))
    (json-pointer-get json "/bar/0/qux")  ;; => "hello"
    (json-pointer-get json "/bar/1")      ;; => 3
    (json-pointer-get json "/baz/boo/2")) ;; => 55