固然主要是這個地方找到的 http://www.lshift.net/blog/2007/02/17/json-and-json-rpc-for-erlang/html
1: illegal record info
12> rfc4626:to_record(R, #address{}, record_info(fields, address)).
** exception error: undefined function rfc4626:to_record/3
13> rfc4627:to_record(R, #address{}, record_info(fields, address)).
‘#address{number = 6,street = <<"Rufus Street">>,
town = <<"London">>,country = <<"England">>}
14> rfc4627:equiv({obj, [{"a", true}, {"b", 123}]}, {obj, [{"a", true}, {"b", 123}]}).
truegit
Eshell V6.0 (abort with ^G)
1> ErlSrc = {struct,[{<<"students">>,
1> [{struct,[{<<"student_number">>,45},
1> {<<"details">>,
1> [{struct,[{<<"FirstName">>,<<"Joshua">>},
1> {<<"Surname">>,<<"Muzaaya">>}]}]}]}]}]}.
{struct,[{<<"students">>,
[{struct,[{<<"student_number">>,45},
{<<"details">>,
[{struct,[{<<"FirstName">>,<<"Joshua">>},
{<<"Surname">>,<<"Muzaaya">>}]}]}]}]}]}
3> JsonDes = mochijson2:encode(ErlSrc).
[123,
[34,<<"students">>,34],
58,
[91,
[123,
[34,<<"student_number">>,34],
58,"45",44,
[34,<<"details">>,34],
58,
[91,
[123,
[34,<<"FirstName">>,34],
58,
[34,<<"Joshua">>,34],
44,
[34,<<"Surname">>,34],
58,
[34,<<"Muzaaya">>,34],
125],
93],
125],
93],
125]
4> mochijson2:decode(JsonDes).
{struct,[{<<"students">>,
[{struct,[{<<"student_number">>,45},
{<<"details">>,
[{struct,[{<<"FirstName">>,<<"Joshua">>},
{<<"Surname">>,<<"Muzaaya">>}]}]}]}]}]}