Closed larskluge closed 4 years ago
I noticed that maps with integer keys get converted to string keys upon encode. This is not a behavior I'd expect and am quite puzzled about (why is this the case?).
According to tests, this is desired behavior: https://github.com/michalmuskala/jason/blob/70b046aee882ca789bebf3a7d173e6259f3fa8aa/test/encode_test.exs#L52
However, how can I encode a map with integer keys as integer keys?
Example:
Jason.encode! %{42 => :bar}
Desired: {42:"bar"} Actual: {"42":"bar"}
{42:"bar"}
{"42":"bar"}
Thank you!
Just realized JSON allows keys to only be strings. My bad.
I noticed that maps with integer keys get converted to string keys upon encode. This is not a behavior I'd expect and am quite puzzled about (why is this the case?).
According to tests, this is desired behavior: https://github.com/michalmuskala/jason/blob/70b046aee882ca789bebf3a7d173e6259f3fa8aa/test/encode_test.exs#L52
However, how can I encode a map with integer keys as integer keys?
Example:
Desired:
{42:"bar"}
Actual:{"42":"bar"}
Thank you!