v / vlib / json / tests / json_decode_anon_struct_test.v
9 lines · 8 sloc · 140 bytes · 8ebbacecd60366ac4ba68aa35f9b0e7a0e56ff61
Raw
1import json
2
3fn test_main() {
4 json_text := '{ "a": "b" }'
5 b := json.decode(struct {
6 a string
7 }, json_text)!.a
8 assert dump(b) == 'b'
9}
10