+ Start a Discussion

Deserializing an object that was formatted using PHP Serialize

I am working on an integration that pushes data to Salesforce using XML as the format.  However, one of the values is serialized and I'm having the hardest time parsing it.  It is getting serialized on the other end using the PHP Serialize function.  Is there anything out there that I can use in Apex that can help deserialize this value?  Even if I have to do a callout with the value to get deserialized data back, I'd be happy with that.  Thanks,




PS - this is an integration with Magento.


Don't do it, if at all possible. Stick with json_encode in PHP, it's far easier to work with in Apex Code. You could also use the XML parser, but I find that JSON is the best in Apex Code, as you can easily slip an entire object from its serialized state into a single usable object in a single line of code.


I agree with you.  However, I have no control over the source application.  I'm doing a callout and the PHP serialized value is what I get so I have to make parse it somehow and was hoping to deserialize it in Apex somehow.