[erlang-questions] No JSON/MAPS interoperability in 17.0?

alisdair sullivan <>
Sun Mar 16 07:28:03 CET 2014


> 
> 1) it's not just a question of do floating point numbers survive the
>   roadtrip, but also integers.

number roundtripping is ok if you are careful and control both encoding and decoding.

it’s strings that are hard. first of all you have to either support lists of code points or some sort of encoded binaries (probably but not necessarily utf8) or you have zero hope of roundtripping losslessly. either “hello world” and <<“hello world”>> are both potentially decoded to the wrong term or you inject meta data like `"__encoding”: “list”` to your json and pray no one else ever uses that key. even if you get that figured out you have a problem with escape sequences. “hello\\u0020world” and “hello world” encode differently but decode to the same string if you interpret escape sequences. if you don’t interpret escape sequences you have a new problem when you try to round trip “hello\tworld”




More information about the erlang-questions mailing list