to (json.Unmarshal()) has my required filed?
question unclear
Check the returned error
Check that field's presence in the struct
You can use json.RawMessage and validate: https://play.golang.org/p/prAGJw3iSVS Or you can use map[string]interface{} as your struct: https://play.golang.org/p/FyGJGDfCm22 Or use the library that @B02s2 shared: https://github.com/buger/jsonparser
Обсуждают сегодня