How do I create a json in clojurescript

后端 未结 3 1494
醉酒成梦
醉酒成梦 2021-02-05 06:32

I have some clojurescript that I want to interop with some javascript libraries. In my clojurescript code I do some analysis and come up with a list of maps. something like

3条回答
  •  天涯浪人
    2021-02-05 07:00

    This works for me:

    (defn clj->json
      [ds]
      (.stringify js/JSON (clj->js ds)))
    

    usage:

    (let [json (clj->json data-structure)]
      ;; do something with json
      )
    

提交回复
热议问题