Skip to content
This repository has been archived by the owner on Jan 28, 2021. It is now read-only.

JSON_EXTRACT returns strings quoted #761

Closed
erizocosmico opened this issue Jun 21, 2019 · 3 comments
Closed

JSON_EXTRACT returns strings quoted #761

erizocosmico opened this issue Jun 21, 2019 · 3 comments
Labels
bug Something isn't working

Comments

@erizocosmico
Copy link
Contributor

select json_extract('{"a": "b"}', '$.a');

returns:

+---------------------------------------+
| JSON_EXTRACT("{\"a\": \"b\"}", "$.a") |
+---------------------------------------+
| "b"                                   |
+---------------------------------------+
1 row in set (0.0010 sec)

But:

select 'b';

Returns:

+-----+
| "b" |
+-----+
| b   |
+-----+
1 row in set (0.0009 sec)
@erizocosmico erizocosmico added the bug Something isn't working label Jun 21, 2019
@eiso
Copy link
Member

eiso commented Jun 21, 2019

Without quotes would be far more intuitive.

@erizocosmico
Copy link
Contributor Author

@eiso note that even though it's more intuitive, it would not be consistent with MySQL's JSON_EXTRACT.

@erizocosmico
Copy link
Contributor Author

Turns out we have JSON_UNQUOTE to fix this. It will be mentioned in the docs.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants