json: cannot unmarshal object into a Go struct field

json: cannot unmarshal object into Go struct field

CODE

package mainimport (
"encoding/json"
"fmt"
)
// DTO object
type mould struct {
Particle tiny
}
type tiny interface {
GetName() string
}
// Implement the interface
type speck struct {
Name string `json:"name"`
}
func (s *speck) GetName() string {
return s.Name
}

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Simplify Complexity

Simplify Complexity

Golang, Distributed Systems, File Systems, Python, C/C++, Linux