v2 / vlib / v / fmt / tests / array_option_anon_struct_keep.vv
22 lines · 19 sloc · 247 bytes · 8201b8a45f86edc6165ba2813bc3120c3ee4ee14
Raw
1module main
2
3import json
4
5struct Data {
6mut:
7 a_token ?[]string
8 dfv ?[]struct {
9 key string
10 }
11}
12
13fn main() {
14 j := '{
15 "a_token2": ["one", "two"],
16 "a_email2": {
17 "email": "[email protected]"
18 }
19 }'
20 d := json.decode(Data, j)!
21 println(d)
22}
23