Skip to main content

Mark Needham: Clojure: Writing JSON to a File/Reading JSON From a File

A few weeks ago I described how I’d scraped football matches using Clojure’s Enlive, and the next step after translating the HTML representation into a Clojure map was to save it as a JSON document. I decided to follow a two step process to achieve this: Convert hash to JSON string; Write JSON string to file. I imagine there’s probably a way to convert the hash to a stream and pipe that into a file but my JSON document isn’t very large so I think this way is ok for now...