I solved this in some bizzaro way. Maybe what is needed is a json parser
which is allowed to be multiple types. Or, another way to think about
parsing which is easier on the type strictness, but still strongly typed.
Like a duck typed struct of some sort. map[string]duck, where duck is
allowed t
You can also unmarshal in stages to Raw and then unmarshal the next piece
based on what you have so far. I presume that you cannot change the format?
On Fri, Sep 15, 2023 at 01:05 Tobias Klausmann
wrote:
> Hi!
>
> On Thu, 14 Sep 2023, Brian Candler wrote:
> > Could you just unmarshal it to a map
Hi!
On Thu, 14 Sep 2023, Brian Candler wrote:
> Could you just unmarshal it to a map[string]IntTSList, and then walk it and
> build whatever structure you want?
I will try and make that work tomorrow, thanks for the hint!
> If you want to pick certain fixed fields into a struct and separate out
Could you just unmarshal it to a map[string]IntTSList, and then walk it and
build whatever structure you want?
If you want to pick certain fixed fields into a struct and separate out the
leftovers to be parsed as "subnet[X].Y", then see
https://stackoverflow.com/questions/33436730/unmarshal-json
Hi!
On Thu, 14 Sep 2023, Peter Galbavy wrote:
> You will need to create a custom type and unmarshal method. Plenty of
> example if you search for "golang custom json unmarshal".
>
> As I've only had to implement it for a couple of simple types I can't offer
> my own valid example.
I am aware
You will need to create a custom type and unmarshal method. Plenty of
example if you search for "golang custom json unmarshal".
As I've only had to implement it for a couple of simple types I can't offer
my own valid example.
On Thursday, 14 September 2023 at 14:36:12 UTC+1 Tobias Klausmann wro