by dev_dull · 7y ago · 0 comments
I guess the better question would be why is there not an easy, standard lib for doing this in any language in 2019?
%{key: "val", key2: [1, 2, 3]}
but the semantics here are actually something like this in JS: {Symbol("key"): new Int8Array(/*utf-8 encoded*/ "val"), Symbol("key2"): new LinkedList([1, 2, 3])}
you can get rid of the `Symbol()` part in the translation, but then the literal becomes: %{"key" => "val", ...}
so, basically, the gap between JSON and Elixir is wider, both syntactically and semantically, than it is in some other popular languages.