| 1 | import json |
| 2 | |
| 3 | pub struct StructB { |
| 4 | kind string |
| 5 | value i32 |
| 6 | } |
| 7 | |
| 8 | fn test_json_i32() { |
| 9 | struct_b := json.decode(StructB, '{"kind": "Int32", "value": 100}')! |
| 10 | assert struct_b == StructB{ |
| 11 | kind: 'Int32' |
| 12 | value: 100 |
| 13 | } |
| 14 | |
| 15 | assert json.encode(struct_b) == '{"kind":"Int32","value":100}' |
| 16 | } |
| 17 |