From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Schulte Subject: Re: Org mode and "shunt" exporters? Date: Fri, 13 Dec 2013 12:29:18 -0700 Message-ID: <87mwk4mtv4.fsf@gmail.com> References: <87zjoe7mf2.fsf@gmail.com> <87k3fdu7dm.fsf@gmail.com> <877gb8woyz.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:55161) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VrYSe-0006sN-5b for emacs-orgmode@gnu.org; Fri, 13 Dec 2013 14:31:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VrYSY-000140-Vg for emacs-orgmode@gnu.org; Fri, 13 Dec 2013 14:31:44 -0500 Received: from mail-pa0-x235.google.com ([2607:f8b0:400e:c03::235]:32802) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VrYSY-00013o-OO for emacs-orgmode@gnu.org; Fri, 13 Dec 2013 14:31:38 -0500 Received: by mail-pa0-f53.google.com with SMTP id hz1so427071pad.26 for ; Fri, 13 Dec 2013 11:31:37 -0800 (PST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Nicolas Goaziou Cc: Brett Viren , emacs-orgmode@gnu.org This should work in a recent Emacs. (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))))) -- Eric Schulte https://cs.unm.edu/~eschulte PGP: 0x614CA05D