MySQL method to extract all keys in nested JSON string
P粉257342166
P粉257342166 2023-08-28 14:17:16
0
1
441

In addition to this answer, is it possible to extract nested keys in a simple way? Example:

{ "a": value, "b": { "c": value, "d": { "e": value } } }

Desired output: ['a', 'b.c', 'b.d.e'] What I've tried:

SELECT f.`id` AS `field_name` FROM table t, JSON_TABLE( JSON_KEYS(t.`column`, '$.b'), '$[*]' COLUMNS( `id` VARCHAR(191) PATH '$' ) ) AS t

But this will only show one of the nested keys and skip the outer keys.

P粉257342166
P粉257342166

reply all (1)
P粉009186469

db<>fiddlehere

    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!