Skip to content

Instantly share code, notes, and snippets.

@geofflane
Last active February 20, 2017 15:04
Show Gist options
  • Save geofflane/b6ac9934bd32fe394c4abfd95d5e1600 to your computer and use it in GitHub Desktop.
Save geofflane/b6ac9934bd32fe394c4abfd95d5e1600 to your computer and use it in GitHub Desktop.
Convert JSON to a file containing an Elixir Map
map = File.read!("/path/to/file.json") |> Poison.decode!()
{:ok,of} = File.open("/path/to/file.exs", [:write, :utf8])
IO.inspect(of, map, limit: 100000, pretty: true)
File.close!(of)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment