Skip to content

Commit

Permalink
allow serializing distinct arrays (#97)
Browse files Browse the repository at this point in the history
A complement to
#93
  • Loading branch information
arnetheduck authored Sep 26, 2024
1 parent 8b51cd8 commit b83739b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions json_serialization/writer.nim
Original file line number Diff line number Diff line change
Expand Up @@ -365,8 +365,12 @@ proc writeValue*(w: var JsonWriter, value: auto) {.gcsafe, raises: [IOError].} =
# to avoid the allocation here:
append $value

elif value is (seq or array or openArray):
w.writeArray(value)
elif value is (seq or array or openArray) or
(value is distinct and distinctBase(value) is (seq or array or openArray)):
when value is distinct:
w.writeArray(distinctBase value)
else:
w.writeArray(value)

elif value is (distinct or object or tuple):
mixin flavorUsesAutomaticObjectSerialization
Expand Down

0 comments on commit b83739b

Please sign in to comment.