[MDEV-30060] JSON path expression with dashes doesn't work Created: 2022-11-21  Updated: 2022-11-21  Resolved: 2022-11-21

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

Type: Bug Priority: Major
Reporter: Ryan Leadenham Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: JSON, JSON_QUERY
Environment:

Tested on Windows but would assume it affects all platforms


Issue Links:
Duplicate
duplicates MDEV-29381 JSON paths containing dashes are repo... Closed
duplicates MDEV-29586 JSON_VALUE and JSON_EXTRACT doesn't h... Closed

 Description   

According to https://mariadb.com/kb/en/jsonpath-expressions/ a path expression with special characters can be quoted as shown below. But doing so returns NULL rather than the JSON data it should. Example is hierarchy from a Chrome Lighthouse report.

SET @json = '{"audits":{"first-contentful-paint":{}}}' ;
 
SELECT
JSON_VALID(@json),
JSON_QUERY(
	@json,
	'$.audits'
),
JSON_QUERY(
	@json,
	'$.audits."first-contentful-paint"'
),
1;



 Comments   
Comment by Ryan Leadenham [ 2022-11-21 ]

The below had previously worked in 10.6

JSON_QUERY(
 
	@json,
 
	'$.audits.first-contentful-paint'
 
)

Comment by Alice Sherepa [ 2022-11-21 ]

Thank you! This is the same bug as MDEV-29586, so I will close the report.

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