If I have a JSON object where the value of a key is an array of integers, and each integer of the array just happens to correspond with the code point of a printable ASCII character, is there any way that I can have Elixir interpret the array as just a plain list of integers and not as a char list?
I've used three different Elixir JSON parsers in an attempt to get a list of integers returned, but they all return the char representation of the list:
iex> JSON.decode!(~s({ "foo": [35, 35] }))
%{"foo" => '##'}
iex> JSX.decode!(~s({ "foo": [35, 35] }))
%{"foo" => '##'}
iex> Poison.decode!(~s({ "foo": [35, 35] }))
%{"foo" => '##'}
What I would like is just %{"foo" => [35, 35]}. Is this possible, or am I missing something? If it's not possible, how should I be decoding this value from JSON into Elixir, and then how would I encode it back into a JSON array should I need to send the JSON on to some other external system?
Edit
Thanks to michalmuskala's answer, I think something clicked, and then with some further investigation, I realised there was really nothing to worry about when it comes to the parsing JSON integer arrays in and out of Elixir:
iex> json = Poison.decode!(~s({ "foo": [35, 35] }))
%{"foo" => '##'}
iex> Poison.encode!(json)
"{\"foo\":[35,35]}"