Question

I have code like this:

index('GET', []) ->
    Users = boss_db:find(consumer, []),
    {json, [{"users", Users}]}.

And I have an error:

{function_clause,
    [{boss_json,json_data1,
         [[{consumer,"consumer-52a3024b4346e12118000001",<<"qwe">>,
               <<"qwe">>},
           {consumer,"consumer-52a302c84346e12118000002",<<"asd">>,
               <<"asd">>},
           {consumer,"consumer-52a305264346e12118000003",<<"zxc">>,
               <<"zxc">>}],
          ["user"],
          []],
         [{file,"src/boss/boss_json.erl"},{line,23}]}

Where is the problem? How to solve it?

Was it helpful?

Solution

Probably a mistake in the last line, users must be an atom, not a string:

 {json, [{users, Users}]}.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top