从文件Golang加载Json时没有值

I hope someone could help me with this issue because I have been scratching my head for a while.

I have a project where I am trying to load json into a struct in go. I have followed exactly several tutorials online, but keep getting no data back and no error.

My json file is called page_data.json and looks like:

[
    {
        "page_title": "Page1",
        "page_description": "Introduction",
        "link": "example_link",
        "authors":
        [
            "Author1",
            "Author2",
            "Author3",
        ]
    },
    // second object, same as the first
]

But when I try the following in go:

package main

import (
"fmt"
"encoding/json"
"os"
"io/ioutil"
 )

type PageData struct {
  Title string `json: "page_title"`
  Description string `json: "page_description"`
  Link string `json: "link"`
  Authors []string `json: "authors"`
}

func main() {
    var numPages int = LoadPageData("page_data.json")
    fmt.Printf("Num Pages: %d", numPages)
}

func LoadPageData(path string) int {
    jsonFile, err := os.Open(path)
    if err != nil {
        fmt.Println(err)
    }
    defer jsonFile.Close()
    byteValue, _ := ioutil.ReadAll(jsonFile)

    var pageList []PageData

    json.Unmarshal(byteValue, &pageList)
    return len(pageList)
}

the output I get is:

Num Pages: 0

Fix the JSON commas and the Go struct field tags. For example,

package main

import (
    "encoding/json"
    "fmt"
    "io/ioutil"
    "os"
)

type PageData struct {
    Title       string   `json:"page_title"`
    Description string   `json:"page_description"`
    Link        string   `json:"link"`
    Authors     []string `json:"authors"`
}

func main() {
    var numPages int = LoadPageData("page_data.json")
    fmt.Printf("Num Pages: %d
", numPages)
}

func LoadPageData(path string) int {
    jsonFile, err := os.Open(path)
    if err != nil {
        fmt.Println(err)
    }
    defer jsonFile.Close()
    byteValue, err := ioutil.ReadAll(jsonFile)
    if err != nil {
        fmt.Println(err)
    }
    var pageList []PageData

    err = json.Unmarshal(byteValue, &pageList)
    if err != nil {
        fmt.Println(err)
    }

    fmt.Println(pageList)

    return len(pageList)
}

Output:

[{Page1 Introduction example_link [Author1 Author2 Author3]}]

page_data.json:

[
    {
        "page_title": "Page1",
        "page_description": "Introduction",
        "link": "example_link",
        "authors":
        [
            "Author1",
            "Author2",
            "Author3"
        ]
    }
]