poison
poison copied to clipboard
Decoding with root object
I'm trying to decode a json object which has a root object.
So basically my json looks like this:
"Id": {
"id": 1561
}
And when I parse it with Poison I would like to get
%Id{id: 1561} == Poison.decode!("\"Id\":{\"id\":1561}", %Id{})
where Id
is:
defmodule Id do
@derive [Poison.Encoder]
defstruct [:id]
end
I couldn't find a way to deal with root object. Is that possible?