Can struct field have two json keys?

Hello Gophers! I have a question for you. Lets say I receive 2 JSON types from same URL I’m requesting depending on query parameter. The difference between those two types is only one field for example:

{ type: "post" webURL: "" text: "longer bla bla bla bla" } { type: "teaser" webURL: "" description: "shorter bla " }

My question is is it possible to unmarshal those two jsons in same struct ? Like json:"key","alternativeKey".

Something like this,, might work.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.