MySQL Forums
Forum List  »  General

Expand JSON_TABLE functionality
Posted by: Андрей Щербаков
Date: December 07, 2018 03:50AM

I tried to wok with JSON_TABLE and think it is not covered one interesting case.

I have such json: '{"a": 5, "b": 3, "c": 4}'
I want to get this result:
| key | value |
| a | 5 |
| b | 3 |
| c | 4 |

One column is key and other - its value. A can't come up with how to get this result.

So, may be, it is possible to expand functionality of JSON_TABLE to something like this:

'{"a": 5, "b": 3, "c": 4}',
'$.*' COLUMNS (
key VARCHAR(50) KEY,
value INT PATH '$'

Options: ReplyQuote

Written By
Expand JSON_TABLE functionality
December 07, 2018 03:50AM

Sorry, only registered users may post in this forum.

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.