So I’m reading about various different ways of dealing with dynamic JSON structures and found a few links that seem to make sense, but I am wondering what possibly the preferred or “best” way is to deal with that kind of JSON ?
figure out what I need (i.e., the go data structures)
figure out how to get what I need from what I have.
Those posts present methods for step 3. @goinggodotnet’s is better for when what you need is scattered about though what you have. Tommi Virtanen’s is better when what you have is mostly what you need (i.e., they have a similar organization). In general there is no best way. The best way always depends on what you have and what you need.
Thanks, that makes sense ! FWIW, I found a tool that can help turning JSON examples into structs so maybe that’s of interest to some people here … https://github.com/ChimeraCoder/gojson
I used above so I can start playing with https://api.gocd.io/current/#dashboard and start building a custom dashboard … much faster than trying to create all those nested structs myself, although I probably would have use different naming for them but it’s just for getting the data out.
Still finding the overall json->struct process a bit clunky but maybe it’s just a thing to get used to hehe