| 1 | import json |
| 2 | |
| 3 | struct Empty {} |
| 4 | |
| 5 | struct SomeStruct { |
| 6 | random_field_a ?string |
| 7 | random_field_b ?string |
| 8 | empty_field ?Empty |
| 9 | } |
| 10 | |
| 11 | type Alias = SomeStruct |
| 12 | |
| 13 | fn test_main() { |
| 14 | data := json.decode(Alias, '{"empty_field":{}}')! |
| 15 | assert data.str() == 'Alias(SomeStruct{ |
| 16 | random_field_a: Option(none) |
| 17 | random_field_b: Option(none) |
| 18 | empty_field: Option(Empty{}) |
| 19 | })' |
| 20 | } |
| 21 |