json_transform v1.0.8 JsonTransform
JsonTransform is a module for transforming the keys of a Map or Struct before conversion to JSON.
Link to this section Summary
Functions
Recursively transforms keys of maps. The root data structure can be a Map or a List
Link to this section Types
Link to this section Functions
Link to this function
transform(value, trans_fn)
transform(value :: map_or_list, trans_fn :: trans_fn) :: map_or_list
Recursively transforms keys of maps. The root data structure can be a Map or a List.
Keys are passed to a user-provided transformation function that accepts a string and returns a transformed string.
Atom map keys are converted to strings before being passed to the transform function.
See JsonTransform.Transformers for a list of included transformation functions. You are also free to provide your own.
Examples
iex> JsonTransform.transform(%{“person_name” => “James Sadler”}, &JsonTransform.Transformers.to_camel/1) %{“personName” => “James Sadler”}