Use Struct Tags For Embedded (with using) Structs When Unmarshalling JSON

A fix for https://github.com/odin-lang/Odin/issues/4539
This commit is contained in:
dozn
2024-12-28 07:48:09 -08:00
committed by GitHub
parent ad99d20d29
commit d22cb20d85

View File

@@ -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