{"action":"opened","issue":{"url":"https://api.github.com/repos/inaka/erlang-katana/issues/55","labels_url":"https://api.github.com/repos/inaka/erlang-katana/issues/55/labels{/name}","comments_url":"https://api.github.com/repos/inaka/erlang-katana/issues/55/comments","events_url":"https://api.github.com/repos/inaka/erlang-katana/issues/55/events","html_url":"https://github.com/inaka/erlang-katana/issues/55","id":75605016,"number":55,"title":"ktn_json","user":{"login":"elbrujohalcon","id":93657,"avatar_url":"https://avatars.githubusercontent.com/u/93657?v=3","gravatar_id":"","url":"https://api.github.com/users/elbrujohalcon","html_url":"https://github.com/elbrujohalcon","followers_url":"https://api.github.com/users/elbrujohalcon/followers","following_url":"https://api.github.com/users/elbrujohalcon/following{/other_user}","gists_url":"https://api.github.com/users/elbrujohalcon/gists{/gist_id}","starred_url":"https://api.github.com/users/elbrujohalcon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elbrujohalcon/subscriptions","organizations_url":"https://api.github.com/users/elbrujohalcon/orgs","repos_url":"https://api.github.com/users/elbrujohalcon/repos","events_url":"https://api.github.com/users/elbrujohalcon/events{/privacy}","received_events_url":"https://api.github.com/users/elbrujohalcon/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/inaka/erlang-katana/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-05-12T13:36:21Z","updated_at":"2015-05-12T13:36:21Z","closed_at":null,"body":"Should we add this module to katana?\r\n```erlang\r\n%% @doc Json abstraction library\r\n-module(ktn_json).\r\n\r\n-export([encode/1, decode/1]).\r\n\r\n-type json() :: #{} | [#{}] | binary() | number() | boolean() | null.\r\n-export_type([json/0]).\r\n\r\n-spec encode(json()) -> iodata().\r\nencode(Json) -> jiffy:encode(Json, [uescape]).\r\n\r\n-spec decode(iodata()) -> json().\r\ndecode(Data) ->\r\n  try jiffy:decode(Data, [return_maps])\r\n  catch\r\n    _:{error, _} ->\r\n      lager:warning(\"Bad Json: ~p\", [Data]),\r\n      throw(bad_json)\r\n  end.\r\n```\r\n\r\nMaybe even a better one where `jiffy` is a parameter (we have that somewhere)."}}