diff --git a/src/Printer.php b/src/Printer.php index 9ce3e2df..a04b7f36 100644 --- a/src/Printer.php +++ b/src/Printer.php @@ -115,14 +115,18 @@ public function print(string $original, bool $unEscapeUnicode, bool $unEscapeSla * Ensure space after ":" character. */ if (':' === $character) { - $character .= ' '; - } elseif ('}' === $character || ']' === $character) { + $printed .= ': '; + + continue; + } + + /** + * Output a new line and indent the next line if the current character indicates the end of an element. + */ + if ('}' === $character || ']' === $character) { --$indentLevel; $previousCharacter = \substr($original, $i - 1, 1); - /** - * Output a new line and indent the next line if the current character indicates the end of an element. - */ if ('{' !== $previousCharacter && '[' !== $previousCharacter) { $printed .= $newLine;