[erlang-questions] Store / use JSON structure in an nice way ?

Thomas Elsgaard thomas.elsgaard@REDACTED
Mon Jun 15 20:33:46 CEST 2015


Thanks to all, i will look at it tonight!

nx: not an bad idea, but this is for the powerdns api (might be that
powerdns is also used for route53)

I need to look closer to erlcloud, it sounds interestingly

Thomas
man. 15. jun. 2015 kl. 19.55 skrev nx <nx@REDACTED>:

> 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/1689d141/attachment.htm>


More information about the erlang-questions mailing list