json_encode() custom object type
Posted: Tue May 18, 2010 5:34 pm
Hi everyone,
Would anybody know how to use json_encode() to encode and preserve object type? What I have is the following:
After json_decode($obj) is done, I get stdClass Object for:
But I need $myObj to be of Web_Services_Object type. Does anybody know how object type Web_Services_Object can be preserved during json_encode() ???
Thank you,
Victor.
Would anybody know how to use json_encode() to encode and preserve object type? What I have is the following:
Code: Select all
$client = new Web_Services_Object;
$client->CallAPI();
$obj = json_encode($client);
Code: Select all
$myObj = json_decode($obj); //is stdClass
Thank you,
Victor.