String how to turn the Map type?

"{b: \"2017-06-01\"}"

to

%{"b" => "2017-06-01"}

String is a javascript object. I want to get elixir map type. Someone can help me?

if you have correct JSON (quoted identifiers) ~s({"b": "2017-06-01"}) you can simply use Poison.

Poison.decode!(~s({"b": "2017-06-01"}))

see: https://hexdocs.pm/poison/api-reference.html

1 Like