Re: [go-nuts] Initializing nested struct, by dynamically forming struct member path

2017-02-23 Thread Nathan Kerr
You gave two different things you want to accomplish: 1. “I am trying to read those values and store in DB” 2. “I will populate the struct and provide it the application for consumption” Fortunately accomplishing either or both of these goals follows a similar process. Start by figuring out wh

Re: [go-nuts] Initializing nested struct, by dynamically forming struct member path

2017-02-22 Thread C Banning
Clean-up example: https://github.com/clbanning/mxj/blob/master/examples/leafnodes.go On Wednesday, February 22, 2017 at 4:31:47 AM UTC-7, C Banning wrote: > > Perhaps not very elegant but seems to produce what you're looking for: > https://play.golang.org/p/bpM69Q-ddV > -- You received this m

Re: [go-nuts] Initializing nested struct, by dynamically forming struct member path

2017-02-22 Thread C Banning
Perhaps not very elegant but seems to produce what you're looking for: https://play.golang.org/p/bpM69Q-ddV -- 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 gola

Re: [go-nuts] Initializing nested struct, by dynamically forming struct member path

2017-02-22 Thread Bharath B
Hi, Thanks for the response. Below is the sample json being used, { "jsondata": [ { "dataReference":[ { "parameterType" : "common", "applicationtype": { "application1": { "applicationName": "appl1", "param1":

Re: [go-nuts] Initializing nested struct, by dynamically forming struct member path

2017-02-21 Thread Nathan Kerr
Could you give an example of the json you are starting from? Also, what database are you using? On Sunday, February 19, 2017 at 8:27:32 AM UTC+1, Bharath B wrote: > > Hi, > > I am trying to read those values and store in DB. > > Regards, > Bharath B > -- You received this message because you ar

Re: [go-nuts] Initializing nested struct, by dynamically forming struct member path

2017-02-18 Thread Bharath B
Hi, I am trying to read those values and store in DB. 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.co

Re: [go-nuts] Initializing nested struct, by dynamically forming struct member path

2017-02-18 Thread roger peppe
It sounds to me like the encoding/json package in the standard library might do what you want. On 18 Feb 2017 15:04, 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 structu

Re: [go-nuts] Initializing nested struct, by dynamically forming struct member path

2017-02-18 Thread Matt Harden
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 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

[go-nuts] Initializing nested struct, by dynamically forming struct member path

2017-02-18 Thread bharathgowda23
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 { ParameterTyp