quick json-to-csv code added by eggless on Wed Feb 25 22:17:21 2015

(define (json->csv in-file out-file)
  (let ((keys (with-input-from-file in-file
		(lambda ()
		  (non-nested-keys (read-json (read-line)))))))
    (with-output-to-file out-file
      (lambda ()
	(write-csv (list keys))
	(with-input-from-file in-file
	  (lambda ()
	    (do ((line (read-line) (read-line)))
		((eof-object? line))
	      (write-csv (list (alist->nested-list (read-json line) keys))))))))))