From cf465919e408387fbbf847035c21cca58dfdcd97 Mon Sep 17 00:00:00 2001 From: Lars Andersen Date: Thu, 1 Jul 2021 01:52:33 +0200 Subject: [PATCH] Replace cheshire with data.json Fixes #306 --- project.clj | 3 +-- src/refactor_nrepl/artifacts.clj | 8 ++++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/project.clj b/project.clj index d2765de9..13bbcbd5 100644 --- a/project.clj +++ b/project.clj @@ -5,7 +5,7 @@ :url "http://www.eclipse.org/legal/epl-v10.html"} :dependencies [[nrepl "0.8.3"] ^:inline-dep [http-kit "2.5.1"] - ^:inline-dep [cheshire "5.10.0"] + ^:inline-dep [org.clojure/data.json "2.3.1"] ^:inline-dep [org.clojure/tools.analyzer.jvm "1.1.0"] ^:inline-dep [org.clojure/tools.namespace "1.1.0" :exclusions [org.clojure/tools.reader]] ^:inline-dep [org.clojure/tools.reader "1.3.5"] @@ -48,7 +48,6 @@ :test {:dependencies [[print-foo "1.0.2"]]} :dev {:global-vars {*warn-on-reflection* true} :dependencies [[org.clojure/clojurescript "1.10.520"] - [javax.xml.bind/jaxb-api "2.3.1"] [cider/piggieback "0.5.2"] [commons-io/commons-io "2.8.0"]] :repl-options {:nrepl-middleware [cider.piggieback/wrap-cljs-repl]} diff --git a/src/refactor_nrepl/artifacts.clj b/src/refactor_nrepl/artifacts.clj index 5bd5ac01..9c31249c 100644 --- a/src/refactor_nrepl/artifacts.clj +++ b/src/refactor_nrepl/artifacts.clj @@ -1,5 +1,5 @@ (ns refactor-nrepl.artifacts - (:require [cheshire.core :as json] + (:require [clojure.data.json :as json] [clojure [edn :as edn] [string :as str]] @@ -69,7 +69,7 @@ search-suffix "%22+AND+p:%22jar%22&rows=2000&wt=json" search-url (str search-prefix group-id search-suffix) {:keys [_ _ body _]} @(http/get search-url (assoc (get-proxy-opts) :as :text)) - search-result (json/parse-string body true)] + search-result (json/read-str body :key-fn keyword)] (map :a (-> search-result :response :docs)))) (defn- get-mvn-versions! @@ -83,7 +83,7 @@ artifact "%22&core=gav&rows=100&wt=json") (assoc (get-proxy-opts) :as :text))] - (->> (json/parse-string body true) + (->> (json/read-str body :key-fn keyword) :response :docs (map :v)))) @@ -102,7 +102,7 @@ (let [{:keys [body status]} @(http/get (str "https://clojars.org/api/artifacts/" artifact))] (when (= 200 status) - (map :version (:recent_versions (json/parse-string body true)))))) + (map :version (:recent_versions (json/read-str body :key-fn keyword)))))) (defn- get-artifacts-from-clojars! []