ErrorList must be [<<"error1">>,<<"error2">>], how you get it is another
question. As far as i remember list of atoms work as well
On Sunday, October 26, 2014 7:19:26 PM UTC+3, Jitin Luthra wrote:
>
> I don't know if its the best way but I use this:
>
> Instead of
> {json, [{error,(ErrorList)}]}
>
> I use:
> {json, [{error,list_to_binary(ErrorList)}]}
>
> This also seems to work:
>
> {json, [{error,io_lib:write_string(ErrorList)}]}
>
> I think the list_to_binary method cannot convert unicode characters (
> http://www.erlang.org/doc/man/unicode.html) so for that case you could
> need to use
>
> {json, [{error,unicode:characters_to_binary(ErrorList)}]}
>
>
> Someone please correct me if I am wrong.
> Thanks,
> Jitin
>
> On Monday, 20 October 2014 12:12:55 UTC+5:30, Alex V wrote:
>>
>>
>>
>> Hi everyone.
>>
>> Saw similar, but unanswered questions.
>>
>> When returning json from a controller, the browser often gets arrays
>> instead of strings (even from tutorial examples, "greeting-N" always
>> becomes an array) and vice versa. How do you control this behavior?
>>
>
--
You received this message because you are subscribed to the Google Groups
"ChicagoBoss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
Visit this group at http://groups.google.com/group/chicagoboss.
To view this discussion on the web visit
https://groups.google.com/d/msgid/chicagoboss/b9f46bed-c38b-4132-92a9-0b0605b58533%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.