parent
27eb19cc48
commit
919593395c
2 changed files with 20 additions and 1 deletions
16
tests/stdlib/toptions.nim
Normal file
16
tests/stdlib/toptions.nim
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
discard """
|
||||
output: '''{"foo":{"test":"123"}}'''
|
||||
"""
|
||||
|
||||
import json, options
|
||||
|
||||
type
|
||||
Foo = ref object
|
||||
test: string
|
||||
Test = object
|
||||
foo: Option[Foo]
|
||||
|
||||
let js = """{"foo": {"test": "123"}}"""
|
||||
let parsed = parseJson(js)
|
||||
let a = parsed.to(Test)
|
||||
echo $(%*a)
|
||||
Loading…
Add table
Add a link
Reference in a new issue