解组转义的JSON字符串[重复]

This question already has an answer here:

I'm trying to Unmarshal a JSON object from an API that has a string inside of the JSON that itself is JSON, but it's escaped as a string. It looks something like this:

{
  "duration": "126.61ms",
  "startTime": "2016-02-19T20:01:17.884Z",
  "total": 123,
  "content": [
  {
    "dateCreated": "2016-02-19T20:01:09.181Z",
    "lastUpdated": "2016-02-19T20:01:09.181Z",
    "name": "name",
    "stats": "{\"id\":545,\"lastUpdated\":\"2015-01-09T19:16:04.535Z\",\"all\":{\"runs\":{\"count\":123}"
  }
}

I'm trying to unmarshal that into a struct like this:

type RunStatus struct {
    Duration string `json:"duration"`
    StartTime time.Time `json:"startTime"`
    Total int `json:"total"`
    Content []struct {
        DateCreated time.Time `json:"dateCreated"`
        LastUpdated time.Time `json:"lastUpdated"`
        name string `json:"name"`
        stats string `json:"stats"`
    } `json:"content"`
}

What's the best way to get the escaped JSON object into a stats struct rather than it being in a string?

</div>

Do this in two phases. First unmarshal the outer object with the stats field as a string, then unmarshal that string into the stats struct. You could do a custom implementation of UnmarshalJSON so this is obfuscated but either way the only reasonable approach I know of is to do the two separately.