The following allows to convert a tuple or object back to an object in erlang:
{ok, Tokens, _} = erl_scan:string("{'abc',123}."),
{ok, X} = erl_parse:parse_term(Tokens).
But when you have a record represented as a string, such as:
-record(myrecord,{firstname,lastname,age}).
...
RecString = "#myrecord{firstname='john',lastname='doe',age=22}.",
{ok, Tokens, _} = erl_scan:string(RecString),
{ok, X} = erl_parse:parse_term(Tokens).
... the above will fail with the message:
** exception error: no match of right hand side value {error,{1,erl_parse,["syntax error before: ",[]]}}
Thoughts on how to achieve that? Thanks.