如何将s3EventRecord从AWS SNS转换为地图(Go)

My data flow is as follows:

  1. File is uploaded to s3 bucket
  2. s3 bucket triggers SNS topic
  3. SNS topic passes s3 event as a message to lambda
  4. Lambda is triggered by SNS and attempts to read record.SNS.Message
  5. I try to convert the message (escaped JSON) to map for easy parsing.

I tried to do like strconv.Unquote but that didn't work. How do I unmarshal this string? Here is my relevant code:

func Handler(request events.SNSEvent) {
    for _, record := range request.Records {
        message := record.SNS.Message
        x := make(map[string]string)
        jsonErr := json.Unmarshal([]byte(message),&x)
        if jsonErr!=nil {
            logger.Errorf("Welp couldn't convert json to a map %s",jsonErr.Error())
        }

Actually, that structure exists in github.com/aws/aws-lambda-go/events. Instead of unmarshaling into a map, use the s3Event struct.

This is how I use this:

    for _, snsEventRecord := range event.Records {
    var s3Event events.S3Event
    err = json.Unmarshal([]byte(snsEventRecord.SNS.Message), &s3Event)
    if err != nil {
        return err
    }

    for _, s3EventRecord := range s3Event.Records {
        fmt.Println(s3EventRecord.S3.Object.Key)
    }