diff --git a/src/is_json.c b/src/is_json.c
index 93bb0456..604cf9e6 100644
--- a/src/is_json.c
+++ b/src/is_json.c
@@ -394,7 +394,7 @@ out:
 	DPRINTF("End general: ", uc, *ucp);
 	*ucp = uc;
 	if (lvl == 0)
-		return rv && (st[JSON_ARRAYN] || st[JSON_OBJECT]);
+		return rv && uc == ue && (st[JSON_ARRAYN] || st[JSON_OBJECT]);
 	return rv;
 }
 
diff --git a/tests/json4.result b/tests/json4.result
new file mode 100644
index 00000000..550d7ac2
--- /dev/null
+++ b/tests/json4.result
@@ -0,0 +1 @@
+JSON text data
\ No newline at end of file
diff --git a/tests/json4.testfile b/tests/json4.testfile
new file mode 100644
index 00000000..7660873d
--- /dev/null
+++ b/tests/json4.testfile
@@ -0,0 +1 @@
+[1]
diff --git a/tests/json5.result b/tests/json5.result
new file mode 100644
index 00000000..90965495
--- /dev/null
+++ b/tests/json5.result
@@ -0,0 +1 @@
+ASCII text
\ No newline at end of file
diff --git a/tests/json5.testfile b/tests/json5.testfile
new file mode 100644
index 00000000..01bd52f2
--- /dev/null
+++ b/tests/json5.testfile
@@ -0,0 +1 @@
+[1] 2
