Implement json.% for enums.
This commit is contained in:
parent
28f3b3d3a7
commit
cdfcc12529
1 changed files with 5 additions and 0 deletions
|
|
@ -737,6 +737,11 @@ proc `%`*(o: ref object): JsonNode =
|
|||
else:
|
||||
result = %(o[])
|
||||
|
||||
proc `%`*(o: enum): JsonNode =
|
||||
## Construct a JsonNode that represents the specified enum value as a
|
||||
## string. Creates a new ``JString JsonNode``.
|
||||
result = %($o)
|
||||
|
||||
proc toJson(x: NimNode): NimNode {.compiletime.} =
|
||||
case x.kind
|
||||
of nnkBracket: # array
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue