Skip to content

Commit

Permalink
Merge pull request #8 from williamthome/fix/encode-lists
Browse files Browse the repository at this point in the history
Fix lists encoding
  • Loading branch information
mworrell authored Oct 4, 2023
2 parents 97edfc3 + 568cbd6 commit 308ad85
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/jsxrecord.erl
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ expand_records({K, V}) ->
expand_records(L) when is_list(L) ->
lists:map(
fun
({K, V}) -> {K, expand_records(V)};
({K, V}) when is_binary(K) -> {K, expand_records(V)};
(V) -> expand_records(V)
end,
L);
Expand Down
6 changes: 6 additions & 0 deletions test/jsxrecord_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ record_defaults(_Config) ->
dates(_Config) ->
<<"\"2008-12-10T13:30:00Z\"">> = jsxrecord:encode({{2008, 12, 10}, {13, 30, 0}}),
{{2008, 12, 10}, {13, 30, 0}} = jsxrecord:decode(<<"\"2008-12-10T13:30:00Z\"">>),

<<"[\"2008-12-10T13:30:00Z\",\"2008-12-10T13:30:00Z\"]">> =
jsxrecord:encode([{{2008, 12, 10}, {13, 30, 0}}, {{2008, 12, 10}, {13, 30, 0}}]),
[{{2008, 12, 10}, {13, 30, 0}}, {{2008, 12, 10}, {13, 30, 0}}] =
jsxrecord:decode(<<"[\"2008-12-10T13:30:00Z\",\"2008-12-10T13:30:00Z\"]">>),

ok.

times(_Config) ->
Expand Down

0 comments on commit 308ad85

Please sign in to comment.