Closed sile closed 3 years ago
This PR adds map_unknown_value encoding option. By this option, we can encode values that aren't supported by default as follows:
map_unknown_value
> IpAddr = {127, 0, 0, 1}. > MapFun = fun ({_,_,_,_} = Ip4) -> {ok, list_to_binary(inet:ntoa(Ip4))}; (_) -> error end. > jsone:encode(#{<<"ipaddr">> => IpAddr}, [{map_unknown_value, MapFun}]). <<"{\"ipaddr\":\"127.0.0.1\"}">>
See also https://github.com/sile/jsone/pull/49
This PR adds
map_unknown_value
encoding option. By this option, we can encode values that aren't supported by default as follows:See also https://github.com/sile/jsone/pull/49