package main
import (
"encoding/json"
"fmt"
"strings"
)
type T struct {
Return []Desc `json:"return"`
}
type Desc struct {
Used string `json:"used"`
Volume string `json:"volume"`
}
func main() {
str := `{"return": [
{
"used":"3Mb",
"volume":"a"
},
{
"used":"3Mb",
"volume":"bbb/a"
}
]
}`
t_struct := T{}
err := json.Unmarshal([]byte(str), &t_struct)
if err != nil {
fmt.Println("error is %v\n", err)
} else {
fmt.Printf("%v\n", strings.Split(t_struct.Return[0].Volume, "/"))
}
}