On Thu, May 27, 2021 at 9:48 AM sharath chandra <sharathchandra...@gmail.com> wrote: > > The issue with Golang to retrieve raw data from Json / string variable > > ``` > I have a Json sample message something similar with special characters > > func main() { > msg := []byte(`{"key":"ABC\u001d\u263aDEF"}`) > m := make(map[string]interface{}) > json.Unmarshal(msg,&m) > ConvertToCsv(m) > } > > > func ConvertToCsv(m map[string]interface{}){ > buf := new(bytes.Buffer) > for k,v := range m { > buf.WriteString(fmt.Sprintf("%v:%v",k,v)) > } > fmt.Println(buf.String()) > } > ``` > > Output is similar to > > ```golang > key:ABCDEF > ``` > > I am expecting something similar to : > key:"ABC\\u001d\\u263aDEF" > > Is this possible by any means ?
https://golang.org/pkg/strconv/#QuoteToASCII Ian -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAOyqgcVB%3Dac2qrT-PiH54tLWdiHjhoU0KdBthWLOwccwRbcPTA%40mail.gmail.com.