#+NAME: radar |----------+------| | Variable | Val | |----------+------| | Red | 43.3 | | Blue | 83.1 | | Yellow | 86.4 | |----------+------| #+begin_src emacs-lisp :exports results :results value :var table=radar (thread-last table ; (org-table-to-lisp) (seq-map (lambda (it) (seq-into it 'vector))) json-encode) #+end_src #+RESULTS: : [["Variable","Val"],["Red",43.3],["Blue",83.1],["Yellow",86.4]]
This seems like a good starting point
(thread-last "|----------+------| | Variable | Val | |----------+------| | Red | 43.3 | | Blue | 83.1 | | Yellow | 86.4 | |----------+------| " org-table-to-lisp (seq-filter (lambda (it) (not (eq it 'hline)))) (seq-map (lambda (it) (thread-last it (seq-map (lambda (it) (or (org-babel--string-to-number it) it))) (pcase--flip seq-into 'vector)))) (pcase--flip seq-into 'vector) json-encode insert)
This uses dash
(->> "|----------+------| | Variable | Val | |----------+------| | Red | 43.3 | | Blue | 83.1 | | Yellow | 86.4 | |----------+------| " org-table-to-lisp (--filter (not (eq it 'hline))) (--map (->> it (--map (or (org-babel--string-to-number it) it)) (apply 'vector))) (apply 'vector) json-encode insert)
[["Variable","Val"],["Red",43.3],["Blue",83.1],["Yellow",86.4]]
[["Variable","Val"],["Red",43.3],["Blue",83.1],["Yellow",86.4]]
orgtbl-to-jsonbut if you look at the definitions oforgtbl-to-csvandorgtbl-to-generic, you might be able to come up with your ownorgtbl-to-json."orgtbl-to-json"to the formats list in theorg-table-exportfunction located inorg-table.elfrom my init. I.e. without having to manually modifyorg-table.el, so when an Emacs update is installed,"orgtbl-to-json"is automatically added.