PHP unserializer
Read serialized PHP data into JSON, without instantiating classes or running PHP.
A clear answer. Here’s how.
A bounded byte parser accepts PHP null, boolean, integer, finite float, UTF-8 string and array tags. Declared string byte lengths and array counts must match exactly and trailing data is refused. Objects, custom serialization, enums and references are refused. Contiguous 0..n−1 keys become JSON lists; other arrays become objects. Empty arrays become []. Non-UTF-8 binary strings and unsafe integers cannot be represented faithfully in JSON and are refused. Up to 200,000 characters, 20,000 values and 64 nesting levels. No native PHP unserialize or code execution is used.
How this is checked
2 reference checks passed These 2 cases were run when this page was built, on 3 December 2026, and all reproduce within the stated tolerance. The same cases are part of the automated tests that run on every change to Toolmoz. Engine version 1.
See the checks and where each expected answer comes from
Case 1
- Inputs
- Source s:5:"Café";
- Expected, and what Toolmoz gave
- text expected "Café", Toolmoz "Café"
- Where the expected answer comes from
- Five UTF-8 bytes decode as the four characters Café.
- Allowed difference
- exact
Case 2
- Inputs
- Source a:2:{i:0;b:0;i:1;N;}
- Expected, and what Toolmoz gave
- text expected [ false, null ], Toolmoz [ false, null ]
- Where the expected answer comes from
- Consecutive integer keys 0 and 1 map to a JSON list containing false and null.
- Allowed difference
- exact
What this shows: the engine reproduces independently worked values for these cases. It does not prove every possible input is right. To test an answer you were given, see how to check a number; to see what is and is not checked across Toolmoz, see the accuracy ledger.
See a worked example
Worked example
A fixed demonstration, separate from the values you enter above.
- Source
- a:2:{s:4:"name";s:5:"Café";s:2:"ok";b:1;}
- Indent
- 2 spaces
Example result
{
"name": "Café",
"ok": true
}