Bug #100272 Handling JSON value with double quotes within it escaped by backslash

Submitted: 21 Jul 2020 8:06 Modified: 21 Jul 2020 13:00
Reporter: Boddu Sushmitha Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: JSON Severity:S3 (Non-critical)
Version: OS:Any
Assigned to: CPU Architecture:Any

[21 Jul 2020 8:06] Boddu Sushmitha
Description:
Even the if the input is valid JSON, It says JSON_VALID() is false

How to repeat:

set @a = '[{"message_body": "{\"log\":{\"file\":{\"path\":\"\/home\/micronode\/techsta       ck\/apache-tomcat\/logs\/localhost_access_log.2020-05-28.txt\"},\"containerized\":false,\"hostname\":\"ubuntu\",\"id\":\"acc2a39f61264838b1acd5a2d6c5507b\"},\"ecs\":{\"version\":\"1.5.0\"}}","message_id": "23","event_time": "2020-06-01 18:10:41"}]';

SELECT JSON_VALID(@a);
-- results 0 even its a valid JSON

Suggested fix:
Specify escape character
[21 Jul 2020 13:00] MySQL Verification Team
Hi Mr. Sushmitha,

Thank you for your bug report.

However, this is not a bug. Simply, our JSON parser has correctly identified that your JSON string is not properly escaped.

Not a bug.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.039 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.