jsonutils.jsonTo: support opt (#16739)
This commit is contained in:
parent
44ceefa9fe
commit
6c07b0a1f8
3 changed files with 9 additions and 4 deletions
|
|
@ -244,9 +244,9 @@ proc fromJson*[T](a: var T, b: JsonNode, opt = Joptions()) =
|
|||
# checkJson not appropriate here
|
||||
static: doAssert false, "not yet implemented: " & $T
|
||||
|
||||
proc jsonTo*(b: JsonNode, T: typedesc): T =
|
||||
proc jsonTo*(b: JsonNode, T: typedesc, opt = Joptions()): T =
|
||||
## reverse of `toJson`
|
||||
fromJson(result, b)
|
||||
fromJson(result, b, opt)
|
||||
|
||||
proc toJson*[T](a: T): JsonNode =
|
||||
## serializes `a` to json; uses `toJsonHook(a: T)` if it's in scope to
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue