diff options
| author | gingerBill <bill@gingerbill.org> | 2022-09-14 16:52:01 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2022-09-14 16:52:01 +0100 |
| commit | db1b7b2d2125fc1ac7e3a7363ea37796d5371fc0 (patch) | |
| tree | 773e2216cb7464e20df346052e8184f4b4c9bcea /core/encoding | |
| parent | a35d6a6f8d726cbf31e639313d920c30c9893190 (diff) | |
Allow for ignored fields in struct for `json.unmarshal`
Diffstat (limited to 'core/encoding')
| -rw-r--r-- | core/encoding/json/unmarshal.odin | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/core/encoding/json/unmarshal.odin b/core/encoding/json/unmarshal.odin index 97d2421d4..792b1edc6 100644 --- a/core/encoding/json/unmarshal.odin +++ b/core/encoding/json/unmarshal.odin @@ -386,7 +386,14 @@ unmarshal_object :: proc(p: ^Parser, v: any, end_token: Token_Kind) -> (err: Unm continue struct_loop } - return Unsupported_Type_Error{v.id, p.curr_token} + // NOTE(bill, 2022-09-14): Previously this would not be allowed + // {"foo": 123, "bar": 456} + // T :: struct{foo: int} + // `T` is missing the `bar` field + // The line below is commented out to ignore fields in an object which + // do not have a corresponding target field + // + // return Unsupported_Type_Error{v.id, p.curr_token} } case reflect.Type_Info_Map: |