Fix json.to for types with generic parameters

This commit is contained in:
Oscar Nihlgård
2018-02-11 23:12:36 +01:00
parent 2199f83280
commit 8247323860
2 changed files with 9 additions and 2 deletions

View File

@@ -380,4 +380,11 @@ when isMainModule:
let dataDeser = to(dataParsed, Test1)
doAssert dataDeser.a == 1
doAssert dataDeser.f == 6
doAssert dataDeser.i == 9.9'f32
doAssert dataDeser.i == 9.9'f32
# deserialize directly into a table
block:
let s = """{"a": 1, "b": 2}"""
let t = parseJson(s).to(Table[string, int])
doAssert t["a"] == 1
doAssert t["b"] == 2