allow serializing distinct arrays (#97)
A complement to https://github.com/status-im/nim-json-serialization/pull/93
This commit is contained in:
parent
8b51cd8bc9
commit
b83739b430
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue