[{...},{...},{...},{...}]
JSON, _ := json.Marshal(userVar1)
fmt.Println(string(JSON))
[{...}{...}{...}{...}]
package main
import (
"encoding/json"
"fmt"
)
type Responses struct {
ID int `json:"id"`
Name string `json:"name"`}
func main() {
var jsonByte = []byte(`[{"ID": 1, "Name": "Пашка"}]`)
var respos []Responses
json.Unmarshal(jsonByte, &respos)
for j := 0; j <= 20; j++ {
respos = append(respos, Responses{ID: j, Name: "Решил"})
}
result, _ := json.Marshal(respos)
fmt.Println(string(result))
}