I want to change keys of maps in elixir from snake case to camel case before sending stuff as JSON. How can I do that? Should it be just a function in which I will wrap every response or should it be done on some lower level, i.e. in Poison?
Thanks
Many don't know that this is built-into Elixir:
iex> Macro.underscore "SAPExample"
"sap_example"
iex> Macro.camelize "sap_example"
"SapExample"
iex> Macro.camelize "hello_10"
"Hello10"
See Macro.underscore/1
docs or the implementation
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With