williamthome / euneus

An incredibly flexible and performant JSON parser, generator and formatter in pure Erlang.
https://hex.pm/packages/euneus
Apache License 2.0
22 stars 2 forks source link

inet plugin on decode converts float-as-string to inet #41

Closed leonardb closed 5 months ago

leonardb commented 5 months ago

I don't have a suggested fix right now, but I'm guessing that ensuring there are at least 4 parts separated by "." for ipv4 and that parts are separated by ":" would be a good check

euneus:decode(<<"{\"test\":\"0.000\",\"ip\":\"10.12.13.14\"}">>,#{plugins => [inet]}).
{ok,#{<<"ip">> => {10,12,13,14},<<"test">> => {0,0,0,0}}}
williamthome commented 5 months ago

Thanks!