PHP Unserializer & Serializer
Convert PHP serialize() strings (s, i, d, b, N, a, O, r/R) into JSON with UTF-8 byte-length accuracy, or serialize JSON back into PHP format.
About This Tool
Parses PHP serialize() payloads (s, i, d, b, N, a, O, r, R) into clean JSON and converts JSON back into valid PHP serialize() strings -- without executing any PHP code.
Uses a UTF-8 byte-stream parser so multi-byte characters (such as accented letters, CJK text, or currency symbols) match PHP strlen() byte counts accurately, and syntax errors report their exact byte offset.
Key Features
- UTF-8 byte-aware string lengths: Measures string and class-name lengths in UTF-8 bytes via TextEncoder/TextDecoder, matching PHP strlen() behavior on multi-byte characters.
- Objects & visibility cleanup: Parses O: serialized objects into {"__phpClass": "..."} and strips null-byte prefixes from protected (\0*\0) and private (\0Class\0) properties.
- Safe reference inspection: Reports internal r: and R: pointer references explicitly without executing __wakeup() or gadget chains.
- Bidirectional JSON to PHP serialize(): Switch direction to convert any JSON object or array into a valid PHP serialize() string with recalculated UTF-8 byte counts.