Skip to content

Instantly share code, notes, and snippets.

@hairyhum
Created January 13, 2016 12:33
Show Gist options
  • Save hairyhum/2fd3e3213867fc51497b to your computer and use it in GitHub Desktop.
Save hairyhum/2fd3e3213867fc51497b to your computer and use it in GitHub Desktop.
-module(json).
-export([decode/1, encode/1]).
% JSON_CODEC can be defined during compilation
-ifndef(JSON_CODEC).
% Default to jsx
-define(JSON_CODEC, jsx).
-endif
decode(Json) ->
?JSON_CODEC:decode(Json, return_maps).
encode(Data) ->
?JSON_CODEC:encode(Data).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment