package main
import (
"bytes"
"fmt"
)
func ToString(m map[string]interface{}) string {
b := new(bytes.Buffer)
for key, value := range m {
fmt.Fprintf(b, "%s=%v\n", key, value)
}
return b.String()
}
func main() {
product := map[string]interface{}{
"id": 1,
"name": "Name 1",
"price": 5.6,
"status": true,
}
fmt.Println(ToString(product))
}
Output
id=1
name=Name 1
price=5.6
status=true