Created
January 26, 2015 02:42
-
-
Save donlindsay/829d5ffb059aca232261 to your computer and use it in GitHub Desktop.
org-as-json-to-file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require 'json) | |
(defun org-as-json-to-file (&optional path) | |
"Export the current Org-mode buffer as JSON to the supplied PATH." | |
(interactive "Fwrite to file: ") | |
(let ((tree (org-element-parse-buffer))) | |
(org-element-map tree | |
(append org-element-all-objects org-element-all-elements) | |
(lambda (el) (org-element-put-property el :parent nil))) | |
(with-temp-file path | |
(insert (json-encode tree))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
found at: http://comments.gmane.org/gmane.emacs.orgmode/79577