We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 843d970 commit 26e091aCopy full SHA for 26e091a
examples/official-site/component.sql
@@ -75,7 +75,14 @@ select
75
group_concat(
76
'select ' || char(10) ||
77
(
78
- with t as (select * from json_tree(top.value)),
+ with t as (
79
+ select *,
80
+ case type
81
+ when 'array' then json_array_length(value)>1
82
+ else false
83
+ end as is_arr
84
+ from json_tree(top.value)
85
+ ),
86
key_val as (select
87
CASE t.type
88
WHEN 'integer' THEN t.atom
@@ -92,8 +99,8 @@ select
92
99
ELSE parent.key
93
100
END as key
94
101
from t inner join t parent on parent.id = t.parent
95
- where ((parent.fullkey = '$' and t.type != 'array')
96
- or (parent.type = 'array' and parent.path = '$'))
102
+ where ((parent.fullkey = '$' and not t.is_arr)
103
+ or (parent.path = '$' and parent.is_arr))
97
104
),
98
105
key_val_padding as (select
106
CASE
0 commit comments