Format / Parse Elixir string to map

I need to convert a string (containg JSON object) to an Elixir map, the string is :

"{\"1458rsdf85srfded\": \"-----BEGIN PUBLIC KEY-----stringstringstring-----END PUBLIC KEY-----\"}"

I need to convert it to :

%{
    "id" => "1458rsdf85srfded",
    "key" => "-----BEGIN PUBLIC KEY-----stringstringstring-----END PUBLIC KEY-----"
}

Thanks in advance

1 Like

You’ll need to use a json library, such as Jason.

1 Like