2 ms·
Got this far and gave up: (let [models (->> (get (clojure.data.json/read-str json-string) "models") (clojure.walk/keywordize-keys))
by sdegutis 10y ago
Got this far and gave up:
(let [models (->> (get (clojure.data.json/read-str json-string) "models")
(clojure.walk/keywordize-keys))
fields (->> models
(mapcat :fields)
(map (juxt (comp keyword :key) :name))
(into {}))
entities (->> models
(mapcat :entities)
(map (juxt :_id (fn [entity]
(->> (for [[k v] (dissoc entity :_id)]
[(get fields k) v])
(into {})))))
(into {}))
]
)
Posted for posterity.