From cce4adac66282ba685dac350d1d03f8b5a57d30f Mon Sep 17 00:00:00 2001 From: wuweixin Date: Sat, 7 Dec 2019 20:38:53 +0800 Subject: [PATCH] Update Serializer.php remove last "," with encode array --- src/Serializer.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Serializer.php b/src/Serializer.php index 34386e3..df9773b 100644 --- a/src/Serializer.php +++ b/src/Serializer.php @@ -67,7 +67,7 @@ private static function encodeArray(array $data, $indent) { $result = $result . $subIndent . $entry; } } - $result = $result . $indent . '}'; + $result = rtrim($result, ",\n") . "\n" . $indent . '}'; return $result; } @@ -118,4 +118,4 @@ private static function encodeBoolean($data) { private static function encodeNull() { return 'nil'; } -} \ No newline at end of file +}