Reputation: 2377
I am getting below output from a string, that I want to decode into a simple array so that I could use those value to process. web-service used below function to return response
echo(var_export($response));
Response
stdClass::__set_state(array(
'criteriaKeyResultsMap' =>
stdClass::__set_state(array(
'477270310' => true,
'528726710' => false,
'517907210' => true,
'497709910' => true,
'253529610' => false,
'529845410' => true,
'519674810' => false,
'517587110' => false,
'477270610' => true,
'260901310' => false,
'260901610' => false,
'529845110' => true,
)),
))
I am trying with json_decode() but it gives same result.
Upvotes: 0
Views: 141
Reputation: 12085
Try this one
json_decode($your_data,true);
It will produce output .
Upvotes: 0
Reputation: 6319
The best fix will be to update your API (if you have control of the source) to use json_encode
instead of var_export
before it does an echo.
Parsing the output of var_export
is possible, but a lot more complex, resource intensive and prone to breakage in the future.
Upvotes: 1