mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
14 lines
228 B
V
14 lines
228 B
V
|
import json
|
||
|
|
||
|
type Test = []string | string
|
||
|
|
||
|
struct Some {
|
||
|
t Test
|
||
|
}
|
||
|
|
||
|
fn test_json_decode_with_sumtype() ? {
|
||
|
v := json.decode(Some, '{"t": ["string", "string2"]}') ?
|
||
|
println(v)
|
||
|
assert '$v.t' == "Test(['string', 'string2'])"
|
||
|
}
|