github.com/aws-cloudformation/cloudformation-cli-go-plugin@v1.2.0/cfn/encoding/unmarshal.go (about) 1 package encoding 2 3 import ( 4 "encoding/json" 5 ) 6 7 // Unmarshal converts stringified-JSON into the passed-in type 8 func Unmarshal(data []byte, v interface{}) error { 9 var dataMap map[string]interface{} 10 var err error 11 err = json.Unmarshal(data, &dataMap) 12 if err != nil { 13 return err 14 } 15 16 err = Unstringify(dataMap, v) 17 if err != nil { 18 return err 19 } 20 21 return nil 22 }