[MDEV-19234] JSON_EXTRACT() returns quotes with strings Created: 2019-04-10  Updated: 2019-04-10  Resolved: 2019-04-10

Status: Closed
Project: MariaDB Server
Component/s: JSON
Affects Version/s: 10.3.13
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Ryan Leadenham Assignee: Sergei Golubchik
Resolution: Not a Bug Votes: 0
Labels: None
Environment:

Windows 10, PHP 7.3



 Description   

When working with JSON_EXTRACT() on a path who's value is a string, the function returns the enclosing quotes which are part of the JSON syntax rather than actually part of the value.

SELECT JSON_EXTRACT('{"test":"hi"}', '$.test') AS test

+------+
| test |
+------+
| "hi" |
+------+
1 row in set (0.000 sec)

Expected Result:

+------+
| test |
+------+
| hi |
+------+
1 row in set (0.000 sec)



 Comments   
Comment by Sergei Golubchik [ 2019-04-10 ]

This is not a bug, JSON_EXTRACT returns a string in a proper JSON notation.

Use JSON_VALUE() if you want a raw value

Generated at Thu Feb 08 08:50:03 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.