Get a specific value from a proplist

320 Views Asked by At

I have a proplist like this:

{ok,{todo,"todo-21","Foo2"}}

How can I get the without the "ok"?

I would like to output this as json in my controller:

{json, {todo,"todo-21","Foo2"}}

Is there some nifty way to do this?

2

There are 2 best solutions below

0
On

This is what I did:

element(2, {ok, {todo, "todo-21", "Foo2"}}).
3
On

Pretty simple, I would say:

tojson({ok,Todo}) -> {json, Todo}.
tojson({ok,{todo,"todo-21","Foo2"}}).