JSON Jolt Transformation with mutual exclusion

I am trying to transform the JSON input using JOLT spec. My entry has a response element that can have a single text value (Case 1) or a JSON element (Case 2) as below

JOLT Spec:

[
  {
    "operation": "shift",
    "spec": {
      "@(1,status)": {
        "@(2,output)": {
          "response": "statusMessage"
        },
        "TERMINATED": {
          "@(2,status)": "statusMessage"
        },
        "FAILED": {
          "@(2,response)": "statusMessage"
        },
        "COMPLETED": {
          "@(2,status)": "statusMessage"
        }
      },
      "status": "status"
    }
  }
]

Input (non-JSON response element). —-Case 1

{
"createTime": 1555623377858,
"updateTime": 1555623378681,
"state": "FAILED",
"exit": {
"response": "Connection error".
}
}

Input (JSON response element). —- Case 2

{
"createTime": 1555623377858,
"updateTime": 1555623378681,
"state": "FAILED",
"exit": {
"answer": {
"headers": {
"ETag": [
          "W/"5-fy9qFc+NorJ+Wkr0e1jnrXHAs9k""
        ],
"Connection": [
          "keep-alive"
        ],
"Content length": [
          "5"
        ],
"Date": [
          "Thu, 18 Apr 2019 21:36:18 GMT"
        ],
"Type of content": [
          "text/html; charset=utf-8"
        ],
"X-Powered-By": [
          "Express"
        ]
      }
"reasonPhrase": "Internal server error",
"body": "error",
"statusCode": 500
}
}
}

How do I specify the JOLT specification if I want to assign "reasonPhrase" to statusMessage in the case that the response has a JSON element?

My exit should be seen as below

The answer to case 1 should be similar.
{
"statusMessage": "Connection error",
"state": "FAILED"
}

The answer of case 2 should look like this.
{
"statusMessage": "Internal server error",
"state": "FAILED"
}