I'm trying to replace the value of model
within this json file. The json file contains:
{
"model": {
"template": "model.txt",
"directory": "app/models",
"filename": "{{Entity}}.php"
},
I'm trying to use the following regex to replace it and am not able to get it to match...
$json = preg_replace('/"model": \{(.*?)\},/i', '"model": false', $json);
I recognize i can change this value after it has been decoded and that is the ideal way to handle this. For various reasons, running this regex would be the simplest way to handle this specific solution.
Here's what I'm working with:
$json = file_get_contents($path);
$json = preg_replace('/"model": \{(.*?)\},/i', '"model": false', $json);
var_dump($json);
exit;