I will make one last effort to convince you not to do this. You asked for ways to improve upon your idea, and the best improvement you could make would be to not do it.
Here's is the PHP version of a config file from Kohana:
$test = array(
'default' => array(
'type' => 'mysql',
'connection' => array(
'hostname' => 'localhost',
'database' => 'kohana',
'username' => FALSE,
'password' => FALSE,
'persistent' => FALSE,
),
'table_prefix' => '',
'charset' => 'utf8',
'caching' => FALSE,
'profiling' => TRUE,
),
'alternate' => array(
'type' => 'pdo',
'connection' => array(
'dsn' => 'mysql:host=localhost;dbname=kohana',
'username' => 'root',
'password' => 'r00tdb',
'persistent' => FALSE,
),
'table_prefix' => '',
'charset' => 'utf8',
'caching' => FALSE,
'profiling' => TRUE,
),
);
And here is the JSON version:
var test = {
"default": {
"type": "mysql",
"connection": {
"hostname": "localhost",
"database": "kohana",
"username": false,
"password": false,
"persistent": false
},
"table_prefix": "",
"charset": "utf8",
"caching": false,
"profiling": true
},
"alternate": {
"type": "pdo",
"connection": {
"dsn": "mysql:host=localhost;dbname=kohana",
"username": "root",
"password": "r00tdb",
"persistent": false
},
"table_prefix": "",
"charset": "utf8",
"caching": false,
"profiling": true
}
};
They're nearly identical. I really fail to see what you're gaining.