I have a JSON object of type []byte
that I created from a struct using json.Marshal
. I want to GZip the JSON before posting it to my endpoint. The following does not work:
gz := gzip.NewWriter(myJSON)
because []byte
does not implement io.Writer
.
Is there some very simple way I can do this once I already have my JSON created?