package main
import (
"encoding/json"
"fmt"
)
type Point struct {
X, Y int
}
func main() {
m := map[string]any{}
var singleCoordinate bool
if singleCoordinate {
m["Coordinates"] = []float32{1, 2}
} else {
m["Coordinates"] = []Point{{X: 1, Y: 2}, {X: 2, Y: 2}}
}
data, err := json.Marshal(m)
fmt.Println(string(data), err)
}