A clear answer. Here’s how.
Parses a literal PHP expression with php-parser, then accepts only strings, finite numbers, booleans, null and nested arrays. An optional PHP opening tag, return and trailing semicolon are accepted. Variables, interpolation, function calls, objects, references, unpacking and executable statements are refused. Integer array keys are converted using PHP rules; consecutive keys 0..n−1 become JSON arrays, other arrays become JSON objects. Empty arrays become []. Integers outside the JavaScript safe range are refused. Up to 200,000 characters, 20,000 values and 64 nesting levels.
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 ['name' => 'Café', 'ok' => true]
- Expected, and what Toolmoz gave
- text expected { "name": "Café", "ok": true }, Toolmoz { "name": "Café", "ok": true }
- Where the expected answer comes from
- The literal PHP keys name and ok map to JSON properties with the unchanged string Café and boolean true.
- Allowed difference
- exact
Case 2
- Inputs
- Source array(1, false, NULL)Indent 2
- Expected, and what Toolmoz gave
- text expected [ 1, false, null ], Toolmoz [ 1, false, null ]
- Where the expected answer comes from
- An unkeyed PHP array uses integer keys 0, 1 and 2, so JSON is a three-element array.
- 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
- ['name' => 'Café', 'enabled' => true, 'tags' => ['web', 'api']]
- Indent
- 2 spaces
Example result
{
"name": "Café",
"enabled": true,
"tags": [
"web",
"api"
]
}