JSON to PHP Array Converter
Transform any JSON object into a PHP array with short syntax ([...]). Strings are quoted with single quotes. Booleans become true/false, null becomes null. Nested objects become associative arrays with => arrow notation. The output is wrapped in <?php\n\nreturn ...;\n so it's ready to include as a PHP config file.
Use Cases
- PHP Config Files — Generate
return [...]config arrays from JSON - API Integration — Convert API response samples to PHP array structures
- Data Migration — Move from JSON-based config to PHP-based config
- Code Generation — Quickly scaffold PHP data structures from JSON schemas
Example
Input:
{
"app": {
"name": "MyApp",
"version": "1.0.0",
"debug": false,
"servers": ["192.168.1.1", "192.168.1.2"],
"database": {
"host": "localhost",
"port": 5432
}
}
}Output:
<?php
return [
'app' => [
'name' => 'MyApp',
'version' => '1.0.0',
'debug' => false,
'servers' => [
'192.168.1.1',
'192.168.1.2',
],
'database' => [
'host' => 'localhost',
'port' => 5432,
],
],
];