Serializing PHP object to JSON
In the simplest cases type hinting should work: $json = json_encode( (array)$object );
In the simplest cases type hinting should work: $json = json_encode( (array)$object );
Serialization is the conversion of an object to a series of bytes, so that the object can be easily saved to persistent storage or streamed across a communication link. The byte stream can then be deserialized – converted into a replica of the original object.