import x.json2 { Any, decode } struct Income { mut: email string code int } pub fn structuring[T](res Any) T { mut typ := T{} res_map := res.as_map() $for field in T.fields { if field.name in res_map { $if field.typ is int { typ.$(field.name) = 2 } typ.$(field.name) = 3 } } return typ } fn main() { res := decode[Any]('{ "email": ["sdvsdv", "sds"], "code": 12 }')!.as_map() structuring[Income](res) }