@ -237,7 +237,7 @@ class JsonFile
}
} else {
// Collapse empty {} and []
$result = rtrim($result);
$result = rtrim($result)."\n\n".$indentStr;
@ -128,6 +128,20 @@ class JsonFileTest extends \PHPUnit_Framework_TestCase
$this->assertJsonFormat($json, $data);
public function testFormatEmptyArray()
{
$data = array('test' => array(), 'test2' => new \stdClass);
$json = '{
"test": [
],
"test2": {
}';
public function testEscape()
$data = array("Metadata\\\"" => 'src/');