KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm getting an error of: json.Unmarshal undefined (type interface {} has no field or method Unmarshal) trying to convert a json byte slice into the generic interface{} type. I'm reading the docs for encoding/json and they give an example that shows this is valid. What gives? package main import ( "encoding/json" "fmt" "io/ioutil" ) func main() { var json interface{} data, _ := ioutil.ReadFile("testMusic.json") json.Unmarshal(data, &json) m := json.(map[string]interface{}) fmt.Printf("%+v", m) }
Tags (comma-separated)
Save Edits
Cancel