Very new to statically typed languages, so I have this complex struct I'm Unmarshalling
type MyStruc1 struct {
Property1 uint16 `json:property1`
Property2 struct {
Sub2Property1 string `json:sub2property1`
Sub2Property2 uint16 `json:sub2property2`
Sub2Property3 struct {
SubSub2Property1 string `json:subsub2property1`
SubSub2Property2 string `json:subsub2property1`
} `json:sub2property3`
} `json:property2`
Property3 struct {
Sub3Property1 string `json:sub3property1`
Sub3Property2 uint16 `json:sub3property2`
Sub3Property3 struct {
SubSub3Property1 string `json:subsub3property1`
SubSub3Property2 string `json:subsub3property1`
} `json:sub3peroperty3`
} `json:property3`
Property4 string `json:property4`
}
How do i write a function or struct method to accept any one of these arrays and return the value from MyStruct1? Is this possible?
strArray1 := []string{"Property2", "Sub2Property3", "SubSub2Property1"}
strArray2 := []string{"Property3", "Sub3Property1"}
strArray3 := []string{"Property4"}
strArray4 := []string{"Property1"}
Thank you ahead of time with any replies