Struct for "no-parent" json structer


How to make a struct/type for this json structer?

Here is another one:


I know this can be unmarshaled with map[string]string

But for some reasons I need a struct.

Any idea to achieve this?

Your first is

type t struct {
  Foo string `json:”foo”`
  Bar string `json:”bar”`

Your second example is not valid json. I’m not sure what you mean by “no-parent”.


Sorry, for my bad formatted question.

And thanks, your snippet works!