fixes #21638; fromJson should support empty objects (#21641)

* fixes #21638; `fromJson` should supports empty objects

* complete the logic
This commit is contained in:
ringabout
2023-04-11 12:38:30 +08:00
committed by GitHub
parent 75205fee93
commit 5e016e4466
2 changed files with 21 additions and 11 deletions

View File

@@ -438,6 +438,11 @@ template fn() =
let json = inner.toJson(ToJsonOptions(enumMode: joptEnumSymbol))
doAssert $json == """{"x":"hello","y":"A"}"""
block: # bug #21638
type Something = object
doAssert "{}".parseJson.jsonTo(Something) == Something()
when false:
## TODO: Implement support for nested variant objects allowing the tests
## bellow to pass.