After the golang array is converted to characters, how to reverse the array or map

[{"id": "114194", "bt": "title 1", "fbsj": "2018-11-12",},
{"id": "114256", "bt": "title 1", "fbsj": "2018-11-16",}]
how to convert this data to an array or map
Thank you!

Feb.08,2022

make your own parser. You can refer to the parsing of the json package to do


is it difficult to define the data structure and unmarshal it?


https://github.com/tidwall/gjson

take a look at this package. You don't have to define the structure, it's easy to use


const data = `
[
{ "id": "114194", "bt": "1", "fbsj": "2018/11/12" },
{ "id": "114256", "bt": "1", "fbsj": "2018/11/16" }
] 
`

type Question struct {
    Id, Bt, Fbsj string
}

    var q []Question
    err := json.Unmarshal([]byte(data), &q)
    if err != nil {
        log.Fatalf(err.Error())
    }
    fmt.Printf("%-sharpv", q)
Menu