PHP scripting to get.post_process


Hello all, I have a MySQL database that is connected to dreamfactory, but some of my records are serialized (PHP). I wrote a PHP script to unserialize it whenever I send a “GET” network request, but it’s not working. I am obtaining my database information from a Swift xcode project using AFNetworking and would like to display the unserialized information.

Can anyone see which part am I doing wrong?
Here’s where I put my php script and the script itself:


$data = $response.meta_value;
function toJSON($theDATA) {
$uns = unserialize(unserialize($theDATA));
$DATA = json_encode($uns);
return $DATA;
$new_data = toJSON($data);
return $new_data;

this is the php serialize:
“meta_value” = “s:306:“a:1:{i:274;a:1:{s:9:“schedules”;a:1:{s:13:“56f5dc96a042f”;a:5:{s:13:“minutes_start”;s:3:“540”;s:11:“minutes_end”;s:4:“1020”;s:5:“weeks”;a:7:{i:1;s:2:“on”;i:2;s:2:“on”;i:3;s:2:“on”;i:4;s:2:“on”;i:5;s:2:“on”;i:6;s:2:“on”;i:0;s:2:“on”;}s:10:“date_start”;s:10:“03/25/2016”;s:8:“date_end”;s:10:“06/15/2016”;}}}}”;”;

and this is what I am trying to get which is json body: