I am trying to convert a RESTful Exception Error object to a string to save it and send an email.
I get the error json_encode(): type is unsupported, encoded as null
. From Googling around, it seems like json_encode is not supposed to have problems, but it doesn't work for resource variables.
This is what the object looks like:
RESTful\Exceptions\HTTPError Object
(
[response] => Httpful\Response Object
(
[body] => stdClass Object
(
[status] => Bad Request
[category_code] => request
[additional] =>
[status_code] => 400
[extras] => stdClass Object
(
[card_uri] => "None" must be a string URI
)
[category_type] => request
[_uris] => stdClass Object
(
)
[request_id] => XXX
[description] => Invalid field [card_uri] - "None" must be a string URI Your request id is XXX.
)
[raw_body] ⇒ {
"status": "Bad Request",
"category_code": "request",
"additional": null,
"status_code": 400,
"extras": {
"card_uri": "\"None\" must be a string URI"
},
"category_type": "request",
"_uris": {},
"request_id": "XXX",
"description": "Invalid field [card_uri] - \"None\" must be a string URI Your request id is XXX."
}