Add a helper for specifying enums types that must be serialized as strings
This commit is contained in:
parent
ec374f26ca
commit
f011bea54b
|
@ -226,3 +226,7 @@ proc toJson*(v: auto, pretty = false, typeAnnotations = false): string =
|
|||
w.writeValue v
|
||||
return s.getOutput(string)
|
||||
|
||||
template serializesAsTextInJson*(T: type[enum]) =
|
||||
template writeValue*(w: var JsonWriter, val: T) =
|
||||
w.writeValue $val
|
||||
|
||||
|
|
Loading…
Reference in New Issue