make sure `jsx_encoder:encode/2' dispatches recursive calls correctly
This commit is contained in:
parent
5db1d9cc05
commit
5fcd4644bf
1 changed files with 6 additions and 2 deletions
|
@ -43,9 +43,13 @@ encode([], _EntryPoint) -> [start_array, end_array];
|
|||
encode([{}], _EntryPoint) -> [start_object, end_object];
|
||||
|
||||
encode([{_, _}|_] = Term, EntryPoint) ->
|
||||
lists:flatten([start_object] ++ [ EntryPoint:encode(T) || T <- unzip(Term) ] ++ [end_object]);
|
||||
lists:flatten(
|
||||
[start_object] ++ [ EntryPoint:encode(T, EntryPoint) || T <- unzip(Term) ] ++ [end_object]
|
||||
);
|
||||
encode(Term, EntryPoint) when is_list(Term) ->
|
||||
lists:flatten([start_array] ++ [ EntryPoint:encode(T) || T <- Term ] ++ [end_array]);
|
||||
lists:flatten(
|
||||
[start_array] ++ [ EntryPoint:encode(T, EntryPoint) || T <- Term ] ++ [end_array]
|
||||
);
|
||||
|
||||
encode(Else, _EntryPoint) -> [Else].
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue