URL to JSON
Clojure
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
doc
src/url2json
test/url2json
.gitignore
README.md
project.clj

README.md

(ns url2json.core
  (:require [cheshire.core :as JSON]))

(defn url2json
  [url]
  (JSON/generate-string
   (hash-map :_data
             (with-open [rdr
                         (clojure.java.io/reader url)]
               (reduce
                #(clojure.string/join "\n" %&)
                (line-seq rdr))))
   {:escape-non-ascii true}))