diff --git a/lib/public/appframework/http/jsonresponse.php b/lib/public/appframework/http/jsonresponse.php
index 1a770109d45810f816d289f1831f93535677e575..456a5616d4dd672fe35452c2bc3d17128f7a7df6 100644
--- a/lib/public/appframework/http/jsonresponse.php
+++ b/lib/public/appframework/http/jsonresponse.php
@@ -61,9 +61,16 @@ class JSONResponse extends Response {
 	 * Returns the rendered json
 	 * @return string the rendered json
 	 * @since 6.0.0
+	 * @throws \Exception If data could not get encoded
 	 */
-	public function render(){
-		return json_encode($this->data);
+	public function render() {
+		$response = json_encode($this->data);
+		if($response === false) {
+			throw new \Exception(sprintf('Could not json_encode due to invalid ' .
+				'non UTF-8 characters in the array: %s', var_export($this->data, true)));
+		}
+
+		return $response;
 	}
 
 	/**
diff --git a/tests/lib/appframework/http/JSONResponseTest.php b/tests/lib/appframework/http/JSONResponseTest.php
index cdd8d269b41a159d5b26c906d34dd207a28e8a0e..692237f57b23b44454fa312bdad69c955b652c14 100644
--- a/tests/lib/appframework/http/JSONResponseTest.php
+++ b/tests/lib/appframework/http/JSONResponseTest.php
@@ -76,6 +76,17 @@ class JSONResponseTest extends \Test\TestCase {
 		$this->assertEquals($expected, $this->json->render());
 	}
 
+	/**
+	 * @expectedException \Exception
+	 * @expectedExceptionMessage Could not json_encode due to invalid non UTF-8 characters in the array: array (
+	 * @requires PHP 5.5
+	 */
+	public function testRenderWithNonUtf8Encoding() {
+		$params = ['test' => hex2bin('e9')];
+		$this->json->setData($params);
+		$this->json->render();
+	}
+
 	public function testConstructorAllowsToSetData() {
 		$data = array('hi');
 		$code = 300;