https://go.dev/play/p/L2IJp-ehA2S
The following program provides me the required output (ccc09e). But this is correct approach or this can be improved.
package main
import (
"encoding/json"
"fmt"
)
type People struct {
Name string
}
func main() {
empJson := `[{"name":"ccc09e"}]`
var emp []People
json.Unmarshal([]byte(empJson), &emp)
s := fmt.Sprintf("%v", emp[0])
s = s[1 : len(s)-1]
fmt.Println(s)
}
I got the required output https://go.dev/play/p/L2IJp-ehA2S and I need improvement to the program.