Parser for json-like format in PHP
The following workaround will wrap your keys and values with double quotes.  Such hacks will always be vulnerable to edge cases.  To avoid sprinting down a rabbit hole of possibilities (I can think of a few cases off the top of my head -- 1. keys/values already containing quotes 2. declared empty/null keys ...there will be more), I'll just provide a solution for your sample input.

For now, I'm using \w to ensure that the space before bar is not included.  There are several ways to do this action, but I would need to have intimate knowledge of your project data to develop the expression that I feel is "best / most robust".

If you discover any fringe cases that break this simple regex pattern, please update your question and I can create a patch.

Code: (Demo)

$unquoted_json = &lt;&lt;&lt;NOTJSON
{foo:{qux:1,quux:0}, bar:{}}
NOTJSON;

$quoted_json = preg_replace('~\w[^:{},]*~', '"$0"', $unquoted_json);
$array = json_decode($quoted_json, true);
var_export($array);
echo "\n---\n";
echo json_encode($array);


Output:

array (
  'foo' =&gt; 
  array (
    'qux' =&gt; '1',
    'quux' =&gt; '0',
  ),
  'bar' =&gt; 
  array (
  ),
)
---
{"foo":{"qux":"1","quux":"0"},"bar":[]}