#+Title: Org to JSON Use Common Lisp as a bridge between Org-mode and JSON. A three step process. 1. First we'll define an Emacs Lisp function to write an Org-mode buffer to a file as Emacs Lisp. #+begin_src emacs-lisp (defun write-org-to-emacs-lisp-file (&optional path) (interactive "Foutput file: ") (cl-flet ((obj-to-path (obj path) (with-temp-file path (prin1 obj (current-buffer))))) (obj-to-path (org-element-parse-buffer) path))) #+end_src 2. Small hack to fix the circular =:parent= issue. #+begin_src sh :var path="/tmp/org-to-json.el" :results none sed 's/#[0-9]\+/:not-the-parent/g' -i $path #+end_src 3. Finally use Common Lisp to read the hacked up Emacs Lisp and use [[http://common-lisp.net/projects/cl-json][cl-json]] to print that as JSON. #+name: emacs-lisp-to-json #+headers: :var in-path="/tmp/org-to-json.el" #+headers: :var out-path="/tmp/org-to-json.json" #+begin_src lisp :results none (with-open-file (in in-path) (with-open-file (out out-path :direction :output) (cl-json:encode-json (read in) out))) #+end_src