I tried to print array with brackets and commas in golang. I want to get
array like this.
["record1", "record2". "record3"]

Encode the array to JSON:

```
package main

import (
        "encoding/json"
        "fmt"
        "log"
        "os"
)

func main() {
        strings := [3]string{"foo", "bar", "baz"}
        stringsJson, err := json.Marshal(strings)
        if err != nil {
                log.Fatal("Cannot encode to JSON ", err)
        }
        fmt.Fprintf(os.Stdout, "%s", stringsJson)
}
```

Output:

["foo","bar","baz"]

Lutz

--
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/6939742d3ca8ea4240b700fdbf64b73f%40posteo.de.

Reply via email to