Liking cljdoc? Tell your friends :D


Convert XML to JSON in Clojure


First we need to parse the XML with this function:

    (defn parse [s] (clojure.xml/parse ( (.getBytes s))))

Then we just use the xml->json:

    (def parsed-xml (parse "<person><name>Salvatore</name><address>Parlermo</address></person>"))
    (def json (xml->json parsed-xml)

Can you improve this documentation? These fine people already did:
Rosario Rascuna & Rosario
Edit on GitHub

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close