Fork me on GitHub
#babashka
<
2024-02-14
>
agorgl15:02:47

Hello! I want to programmatically edit a (deps.)edn file without messing with its layout, e.g. append a value to one of its vectors or add a key/value pair in one of its sub-maps. When using either *input* or (-> *in* slurp clojure.edn/read-string) the maps become namespaced with #: and the order in the maps keys' is lost. How can I approach this?

grav16:02:09

Wrt ordering, hashmaps have no ordering, so you'd need to represent the data with something else. Edamame is able to parse a string (eg the contents of a deps.edn file) and represent it as an ordered map: https://clojurians.slack.com/archives/C06MAR553/p1706613676471569

agorgl16:02:58

damn, exactly what I needed