JsonMap alphabetize

This commit is contained in:
2023-08-24 14:53:12 -06:00
parent 3712747b0e
commit ac3a8ba895

View File

@@ -4,10 +4,16 @@
(dictSet m key (defaultVal.parse representation)))))
(method stringify []
(Json.stringify
(for =>k v m =>k (v.stringify))
null
"\t"))
(let [json
(Json.stringify
(for =>k v m =>k (v.stringify))
null
"\t")
lines
(json.split "\n")]
(lines.shift) // {
(lines.pop) // }
(+ "{\n" (.join (sort lines) "\n") "\n}")))
(defNew [&prop :String jsonPath &prop :T defaultVal]
[:Map<String,T> m (new Map)]