При энкодинге выводит: {"Tables":{"Id":{"Column":{},"Row":{},"Border":{}}}}
А хочется (и в целом, каким должна быть структура для этого JSON?) :
{
"tables": {
"table_001": {
"dx":10.5, "dy": 10.5,
"column": {
"widths": [1.0, 1.0, 1.0],
"align":[1,3,3],
"colors": ["#1513","#1513","#1513"]
},
"row": {
"heights": [1.0, 1.0, 1.0],
"align": [3, null, null],
"colors": ["#1513","#1513","#1513"]
},
"border": {
"color": "#12244",
"style": "solid",
"width": 1,
"drawb": [
["ltrb", "ltrb", "ltrb"],
["ltrb", "ltrb", "ltrb"],
["ltrb", "ltrb", "ltrb"]
]
},
"tcont": [
["рорпорп", "ID", "Year"],
["ывывп", "1212", "2014"],
["вапвапва", "1ht212", "2014"]
]
}
}
}
package main
import (
"encoding/json"
"fmt"
)
func main() {
type column struct {
widths []float64
align []int32
colors []string
}
type row struct {
heights []float64
align []int32
colors []string
}
type border struct {
width float64
drawb [][]string
color string
style string
}
type table struct {
dx float64
dy float64
Column column
Row row
Border border
tcont [][]string
}
type tables struct {
Id table
}
type jsonn struct {
Tables tables
}
var tle = jsonn{
Tables: tables{
Id: table{
dx: 10.5, dy: 10.5,
Column: column{
widths: []float64{70.0, 20.0, 20.0},
align: []int32{1, 1, 1},
colors: []string{"", "", ""},
},
Row: row{
heights: []float64{40.0, 40.0, 40.0},
align: []int32{1, 1, 1},
colors: []string{"", "", ""},
},
Border: border{
width: 1.0,
drawb: [][]string{
{"ltrb", "ltrb", "ltrb"},
{"ltrb", "ltrb", "ltrb"},
{"ltrb", "ltrb", "ltrb"},
},
color: "#000000",
style: "solid",
},
tcont: [][]string{
{"polplpl", "ID", "Year"},
{"blablabla", "1212", "2014"},
{"blablabla", "1ht212", "2014"},
},
},
},
}
b,err := json.Marshal(tle)
if err != nil {
fmt.Println("error:", err)
}
fmt.Printf("%s\n", b)
}