don't know how to define nested objects in CB, so i use prolists for this purpose. Unfort. if you return json with record where one of the fields is proplist cb crashes due to is_list() and following list_to_binary(Val) what is not quite correct.
So i made changes in boss_model_manager_boss_db.erl (attached) to solve this, works fine for me.
Also i have made changes in date/time formatting as 1) lists are no good for json, they are converted to Arrays, binary is much better 2) it is better to pass date/time in universal format "cO" and make formatting on client side with JS
to_json(Object) ->
Data = lists:map (fun
({Attr, Val}) when is_list (Val) ->
%{Attr, list_to_binary (Val)}; %original, removed by can2nac, 15-05-14
{Attr, case is_proplist(Val) of true -> Val; false -> list_to_binary (Val) end}; %added by can2nac, 15-05-14
({Attr, {_,_,_} = Val}) ->
%%list_to_binary was added and format was changed
{Attr, list_to_binary (erlydtl_filters:date (calendar:now_to_datetime (Val), "cO"))}; %added by can2nac, 15-05-14
%{Attr, erlydtl_filters:date (calendar:now_to_datetime (Val), "F d, Y H:i:s")}; %original, removed by can2nac, 15-05-14
({Attr, {{_, _, _}, {_, _, _}} = Val}) ->
%%format was changed
{Attr, list_to_binary (erlydtl_filters:date (Val, "cO"))}; %added by can2nac, 15-05-14
%{Attr, list_to_binary (erlydtl_filters:date (Val, "F d, Y H:i:s"))}; %original, removed by can2nac, 15-05-14
(Other) ->
Other
end, Object:attributes()),
{struct, Data}.
%%added by can2nac, 05-15-14, taken from
is_proplist([]) -> true;
is_proplist([{K,_}|R]) when is_atom(K) -> is_proplist(R);
is_proplist([A|R]) when is_atom(A) -> is_proplist(R); %added by can2nac, 15-05-14
is_proplist([A]) when is_atom(A) -> true; %added by can2nac, 15-05-14
is_proplist(_) -> false.