[MDEV-29995] JSON_VALID is not able to validate nested json Created: 2022-11-10  Updated: 2023-11-28

Status: Confirmed
Project: MariaDB Server
Component/s: JSON
Affects Version/s: 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9
Fix Version/s: 10.4, 10.5, 10.6

Type: Bug Priority: Major
Reporter: Tony Assignee: Rucha Deodhar
Resolution: Unresolved Votes: 0
Labels: None


 Description   

JSON_VALID is not able to validate multiple level json.
E.g:

SELECT JSON_VALID('[{"frames":[{"test":{"caca":[{"maca":{"caca":[{"frames":[{"test":{"caca":[{"maca":{"caca":[{"frames":[{"test":{"caca":[{"maca":{"caca":[{"frames":[{"test":{"caca":[{"maca":{"caca":123}}]}}],"id":""}]}}]}}],"id":""}]}}]}}],"id":""}]}}]}}],"id":""}]') as isValid;



 Comments   
Comment by Alice Sherepa [ 2022-11-10 ]

Thanks! reproducible on 10.3-10.10

MariaDB [(none)]> SELECT JSON_VALID ('
[{ "c": [{ "d": { "a": [{ "b": { "a": [{ "c": [{ "d": { "a": [{ "b": { "a": [{ "c": [{ "d": { "a": [{
"b": { "a": [{ "c": [{ "d": { "a": [{ "b": {} }] } }] }] }
}] } }] }] } }] } }] }] } }] } }] }]
') as isvalid;
+---------+
| isvalid |
+---------+
|       0 |
+---------+
1 row in set (0,000 sec)
 
MariaDB [(none)]> SELECT JSON_VALID ('
[{ "c": [{ "d": { "a": [{ "b": { "a": [{ "c": [{ "d": { "a": [{ "b": { "a": [{ "c": [{ "d": { "a": [{
"b": { "a": [{ "c": [{ "d": { "a": [{ "b": 1 }] } }] }] }
}] } }] }] } }] } }] }] } }] } }] }]
') as isvalid;
+---------+
| isvalid |
+---------+
|       1 |
+---------+
1 row in set (0,000 sec)

Comment by Weijun Huang [ 2023-02-11 ]

I checked the case

SELECT JSON_VALID('[{"a": [{"b": {"c": {"d": {"e": "value"}}}}]}]') as isValid;

, which can work. So I guess the root od bug is not about nested json.

Generated at Thu Feb 08 10:12:51 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.