Skip to content

Commit 5231900

Browse files
authored
Merge pull request #1903 from mrrobot47/improve/json-formatter
fix(formatter): improve JSON output formatting
2 parents a761905 + 285886f commit 5231900

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

php/EE/Formatter.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,9 @@ private function format( $items, $ascii_pre_colorized = false ) {
156156

157157
if ( 'json' === $this->args['format'] ) {
158158
if ( defined( 'JSON_PARTIAL_OUTPUT_ON_ERROR' ) ) {
159-
echo json_encode( $out, JSON_PARTIAL_OUTPUT_ON_ERROR );
159+
echo json_encode( $out, JSON_PRETTY_PRINT | JSON_PARTIAL_OUTPUT_ON_ERROR );
160160
} else {
161-
echo json_encode( $out );
161+
echo json_encode( $out, JSON_PRETTY_PRINT );
162162
}
163163
} elseif ( 'yaml' === $this->args['format'] ) {
164164
echo Spyc::YAMLDump( $out, 2, 0 );
@@ -200,7 +200,7 @@ private function show_single_field( $items, $field ) {
200200
}
201201

202202
if ( 'json' == $this->args['format'] ) {
203-
echo json_encode( $values );
203+
echo json_encode( $values, JSON_PRETTY_PRINT );
204204
}
205205
}
206206

0 commit comments

Comments
 (0)