The following program sample.go triggers an unexpected result
package main
import (
"encoding/json"
"fmt"
)
func main() {
jsonString := `{"MyField":[1,2,3,4]}`
var parsed map[string]interface{}
json.Unmarshal([]byte(jsonString), &parsed)
switch parsed["MyField"].(type) {
case []interface{}:
fmt.Println("MyField is an array")
default:
fmt.Println("Didn't match any type")
}
}
The following program
sample.go
triggers an unexpected resultExpected result
Got
Yaegi Version
v0.10.0
Additional Notes
No response