Description: Fails to detect JSON in case of empty array with spaces.
Author: Vincent Lefevre <vincent@vinc17.net>
Last-Update: 2022-06-06

diff --git a/src/is_json.c b/src/is_json.c
index c276b7be..36cccbdf 100644
--- a/src/is_json.c
+++ b/src/is_json.c
@@ -183,6 +183,7 @@ json_parse_array(const unsigned char **ucp, const unsigned char *ue,
 
 	DPRINTF("Parse array: ", uc, *ucp);
 	while (uc < ue) {
+		uc = json_skip_space(uc, ue);
 		if (*uc == ']')
 			goto done;
 		if (!json_parse(&uc, ue, st, lvl + 1))
diff --git a/tests/Makefile.am b/tests/Makefile.am
index b17dfb12..4b2f4989 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -41,6 +41,8 @@ json4.result \
 json4.testfile \
 json5.result \
 json5.testfile \
+json6.result \
+json6.testfile \
 matilde.arm.result \
 matilde.arm.testfile \
 pcjr.result \
diff --git a/tests/json6.result b/tests/json6.result
new file mode 100644
index 00000000..550d7ac2
--- /dev/null
+++ b/tests/json6.result
@@ -0,0 +1 @@
+JSON text data
\ No newline at end of file
diff --git a/tests/json6.testfile b/tests/json6.testfile
new file mode 100644
index 00000000..db310f37
--- /dev/null
+++ b/tests/json6.testfile
@@ -0,0 +1 @@
+{"a":[ ]}
