I am using this bit of code to catch Exceptions from the Google Calendar API
//authorize the client
      try{
          $client = $this->gcal_sync_auth($crm_user_id);
        }
      catch (Exception $ex) 
        {
      $message = $ex->getMessage();
      die("could not connect ". $message);
        }
The $ex->getMessage() works fine and returns the exception message as a string, but it is formatted as below.  I have never encountered an array like this. It looks like JSON but seems malformed.  How can I just access/print the "Invalid email or User ID" without the rest.
    Google_Auth_Exception Object
(
    [message:protected] => Error refreshing the OAuth2 token, message: '{
  "error" : "invalid_grant",
  "error_description" : "Invalid email or User ID"
}'
    [string:Exception:private] => 
    [code:protected] => 400
    [file:protected] => xxx/application/third_party/Google_API/src/Google/Auth/OAuth2.php
    [line:protected] => 364
    [trace:Exception:private] => Array
        (
            [0] => Array
                (
                    [file] => xxx/application/third_party/Google_API/src/Google/Auth/OAuth2.php
                    [line] => 315
                    [function] => refreshTokenRequest
                    [class] => Google_Auth_OAuth2
                    [type] => ->
                    [args] => Array
                        (
                            [0] => Array
                                (
                                    [grant_type] => assertion
                                    [assertion_type] => http://oauth.net/grant_type/jwt/1.0/bearer
                                    [assertion] =>
                                    [serviceAccountName] =>              xxxxx@xxxxxx.iam.gserviceaccount.com
                                    [scopes] => https://www.googleapis.com/auth/calendar
                                    [privateKey] =>
 
    