It's currently possible for two dicts to be equal yet have a different JSON encoding, depending on the order of the entries:
» Dict.from_list([("a", "b"), ("c", "d")]) == Dict.from_list([("c", "d"), ("a", "b")])
True
» Json.to_str_try(Dict.from_list([("c", "d"), ("a", "b")]))
Ok("{\"c\":\"d\",\"a\":\"b\"}")
» Json.to_str_try(Dict.from_list([("a", "b"), ("c", "d")]))
Ok("{\"a\":\"b\",\"c\":\"d\"}")
IMHO, Dict JSON should have sorted entries, just like records:
» {a: "one", b: "two"}->Json.to_str_try()
Ok("{\"a\":\"one\",\"b\":\"two\"}")
» {b: "two", a: "one"}->Json.to_str_try()
Ok("{\"a\":\"one\",\"b\":\"two\"}")
It's currently possible for two dicts to be equal yet have a different JSON encoding, depending on the order of the entries:
IMHO, Dict JSON should have sorted entries, just like records:
» {a: "one", b: "two"}->Json.to_str_try() Ok("{\"a\":\"one\",\"b\":\"two\"}") » {b: "two", a: "one"}->Json.to_str_try() Ok("{\"a\":\"one\",\"b\":\"two\"}")