[erlang-questions] Store / use JSON structure in an nice way ?
nx
nx@REDACTED
Mon Jun 15 19:55:11 CEST 2015
Use a library for converting Erlang terms to JSON.
Jiffy: https://github.com/davisp/jiffy
JSX: https://github.com/talentdeficit/jsx
For JSX, you could do the following:
Payload = [{<<"rrsets">>, [{<<"name">>, <<"xxx.gl">>}, {<<"type">>,
<<"A">>}, {<<"changetype">>, <<"REPLACE">>}, {<<"records">>,
[{<<"content">>, <<"2.1.1.1">>}, {<<"disabled">>, false}, {<<"name">>, <<"
xxx.gl">>}, {<<"ttl">>, <<"3600">>}, {<<"type">>, <<"A">>},
{<<"priority">>, <<"0">>}]}]}],
Options = [],
Json = jsx:encode(Payload),
{ok, StatusCode, RespHeaders, ClientRef = hackney:request(Method, URL,
Headers, Json, Options).
Side-note: maybe you could make a PR to erlcloud (
https://github.com/gleber/erlcloud) to get Route53 support in? :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20150615/d0a838b7/attachment.htm>
More information about the erlang-questions
mailing list