Bug #81896 | Can't use JSON when json name has dash inside | ||
---|---|---|---|
Submitted: | 17 Jun 2016 4:26 | Modified: | 20 Jun 2016 14:32 |
Reporter: | Vadim Tkachenko | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server: JSON | Severity: | S3 (Non-critical) |
Version: | 5.7.13 | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[17 Jun 2016 4:26]
Vadim Tkachenko
[17 Jun 2016 7:00]
MySQL Verification Team
Hello Vadim, Thank you for the report and feedback! Thanks, Umesh
[20 Jun 2016 14:32]
Knut Anders Hatlen
Hi Vadim, I think what you are seeing matches what is documented here: http://dev.mysql.com/doc/refman/5.7/en/json-path-syntax.html In particular this part: "Names of keys must be double-quoted strings or valid ECMAScript identifiers" Hyphens are not allowed in ECMAScript identifiers, so the name needs to be quoted in the path expression. This seems to work: mysql> select JSON_EXTRACT(j1, '$."cache-size"') from tt; +------------------------------------+ | JSON_EXTRACT(j1, '$."cache-size"') | +------------------------------------+ | 10 | | NULL | +------------------------------------+ 2 rows in set (0,00 sec)