package main import \"fmt\" import \"encoding/json\" type Track struct { XmlRequest string `json:\"xmlRequest\"` } func main() { message := new(Track)
Custom function is not kind of the best solution.
How about another library to solve this. I use gabs
gabs
import
go get "github.com/Jeffail/gabs"
use
message := new(Track) resultJson,_:=gabs.Consume(message) fmt.Println(string(resultJson.EncodeJSON()))
I solve that problem like this.