2017-03-20 37 views
0

中提取數據,我有一個名爲表newdata蜂巢 - 從嵌套的Json

create external table newdata 
(
data string 
) 
location 'something' 

select data from string limit 1

{ "user": { "name": "default", "education": { "schoome": "abc", "college": "def" } } 

我需要顯示此結果作爲

|用戶|名稱|學校|大學|

| -------- | --------- | ---------- | ----------- |

+0

'schoome'? :-) ... –

+0

提取''用戶'' –

+0

P.沒有意義。這似乎是一個簡單的例子。你有什麼特別的問題嗎? –

回答

0
select json_extract_scalar (data,'$.user.name')    as name 
     ,json_extract_scalar (data,'$.user.education.school') as school 
     ,json_extract_scalar (data,'$.user.education.college') as college 

from newdata