public
anonymous / recjson.erl
Last active

  • Download Gist
recjson.erl
Erlang
1 2 3 4 5 6 7 8
-record(topscore, {place, user_id, score}).
-record(topscores, {scores}).
 
T1 = #topscore{place = <<"1">>, user_id = <<"Us">>, score = <<"200">>},
T2 = #topscore{place = <<"2">>, user_id = <<"Us2">>, score = <<"400">>},
Scores = #topscores{scores = [T1|T2]},
Json = ?record_to_json(topscores, Scores),
io:format("~p~n", [Json]).

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.