|
@@ -430,6 +430,11 @@ class JsonManipulator
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ // check that we are not leaving a dangling comma on the previous line if the last line was removed
|
|
|
|
+ if (preg_match('#,\s*$#', $matches['start']) && preg_match('#^\}$#', $matches['end'])) {
|
|
|
|
+ $matches['start'] = rtrim(preg_replace('#,(\s*)$#', '$1', $matches['start']), $this->indent);
|
|
|
|
+ }
|
|
|
|
+
|
|
$this->contents = $matches['start'] . $matches['end'];
|
|
$this->contents = $matches['start'] . $matches['end'];
|
|
if (preg_match('#^\{\s*\}\s*$#', $this->contents)) {
|
|
if (preg_match('#^\{\s*\}\s*$#', $this->contents)) {
|
|
$this->contents = "{\n}";
|
|
$this->contents = "{\n}";
|