jsonutils.jsonTo: support opt (#16739)

This commit is contained in:
Timothee Cour 2021-01-17 02:37:06 -08:00 • committed by GitHub
commit 6c07b0a1f8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 4 deletions

View file

@ -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