There is a problem with golang parsing json.

package main

import (
    "encoding/json"
    "fmt"
)

type Server struct {
    ServerName string
    ServerIP   string
}

type Serverslice struct {
    Servers []Server
    total string
}

func main() {
    var s Serverslice
    str := `{"total":"10", "servers":[{"serverName":"Shanghai_VPN","serverIP":"127.0.0.1"},{"serverName":"Beijing_VPN","serverIP":"127.0.0.2"}]}`
    json.Unmarshal([]byte(str), &s)
    fmt.Println(s)
}

run result:

{[{Shanghai_VPN 127.0.0.1} {Beijing_VPN 127.0.0.2}] }

Why not display total. Is there something wrong?

Mar.22,2021

total is lowercase and cannot be exported. Read more documents

.
Menu