0

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?

Charles
  • 50,943
  • 13
  • 104
  • 142
Sebastian Hoitz
  • 9,343
  • 13
  • 61
  • 77

2 Answers2

2

Pretty simple, I would say:

tojson({ok,Todo}) -> {json, Todo}.
tojson({ok,{todo,"todo-21","Foo2"}}).
Alin
  • 818
  • 5
  • 11
0

This is what I did:

element(2, {ok, {todo, "todo-21", "Foo2"}}).
Sebastian Hoitz
  • 9,343
  • 13
  • 61
  • 77