Index: src/wp-includes/default-constants.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/wp-includes/default-constants.php	(revision 41604)
+++ src/wp-includes/default-constants.php	(date 1506464454878)
@@ -92,6 +92,10 @@
 		define( 'SCRIPT_DEBUG', $develop_src );
 	}
 
+	// Add define( 'WP_DEBUG_REST_API', true ); to wp-config.php to enable pretty JSON in the REST API during development.
+	if ( ! defined( 'WP_DEBUG_REST_API' ) )
+		define( 'WP_DEBUG_REST_API', false );
+
 	/**
 	 * Private
 	 */
Index: src/wp-includes/rest-api/class-wp-rest-server.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/wp-includes/rest-api/class-wp-rest-server.php	(revision 41604)
+++ src/wp-includes/rest-api/class-wp-rest-server.php	(date 1506464547488)
@@ -393,7 +393,9 @@
 			 */
 			$result = apply_filters( 'rest_pre_echo_response', $result, $this, $request );
 
-			$result = wp_json_encode( $result );
+			$options = ( defined( 'WP_DEBUG_REST_API' ) && WP_DEBUG_REST_API ) ? JSON_PRETTY_PRINT : 0;
+
+			$result = wp_json_encode( $result, $options );
 
 			$json_error_message = $this->get_json_last_error();
 			if ( $json_error_message ) {
