1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

x.json2: add json2.map_from(t T) (#16797)

This commit is contained in:
Hitalo Souza
2023-01-18 13:55:04 -03:00
committed by GitHub
parent 2c78078814
commit 525c5e237a
3 changed files with 177 additions and 17 deletions

View File

@ -73,7 +73,7 @@ fn test_types() {
assert json.decode[StructType[int]]('{"val": 0}')!.val == 0
assert json.decode[StructType[int]]('{"val": 1}')!.val == 1
assert json.decode[StructType[int]]('{"val": 2}')!.val == 2
assert json.decode[StructType[int]]('{"val": "true"}')!.val == 1
assert json.decode[StructType[int]]('{"val": "true"}')!.val == 0
assert json.decode[StructType[int]]('{"val": "false"}')!.val == 0
assert json.decode[StructType[int]]('{"val": true}')!.val == 1
assert json.decode[StructType[int]]('{"val": false}')!.val == 0