Why do you want to to this? What are you actually trying to accomplish? See http://xyproblem.info/
On Sat, Feb 18, 2017 at 7:04 AM <bharathgowd...@gmail.com> wrote: > Hi, > > I am learning Go language and also to technical terms like in subject > "struct member path" (don't know if right). > > I need help to initialize a nested structure like below, by getting the > struct member names at runtime. > > type jsonData struct { > DataReference []struct { > ParameterType string > Applicationtype struct { > *Application1* struct { > ApplicationName string > *Param1* struct { > Name string > } > *Param2* struct { > Name string > } > } > *Application2 *struct { > ApplicationName string > *Param1* struct { > Name string > } > *Param2 *struct { > Name string > } > } > } > } > } > > I want to form the "*struct member path*" > *jsonData.DataReference[0].Applicationtype.Application1.Param1.Name > <http://Applicationtype.Application1.Param1.Name>* at runtime where I > will get the value "*1*" as index in "Application*1*" & "Param*1*" at > runtime by iterating the obtained *JSON *when using GOs range. > > And similarly based on the index, will initialize *Application1.Param2.Name > <http://Application1.Param2.Name>*, *Application2.Param1.Name > <http://Application2.Param1.Name>*. > > It would be of great help, if someone could help me here. > > Thanks in advance. > > Regards, > Bharath B > > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.