Skip to content

Commit

Permalink
Use Struct Tags For Embedded (with using) Structs When Unmarshallin…
Browse files Browse the repository at this point in the history
…g JSON

A fix for #4539
  • Loading branch information
dozn authored Dec 28, 2024
1 parent ad99d20 commit d22cb20
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/encoding/json/unmarshal.odin
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ unmarshal_object :: proc(p: ^Parser, v: any, end_token: Token_Kind) -> (err: Unm
}
}

if field.name == key {
if field.name == key || (field.tag != "" && reflect.struct_tag_get(field.tag, "json") == key) {
offset = field.offset
type = field.type
found = true
Expand Down

0 comments on commit d22cb20

Please sign in to comment.