select a._id, b.* from ( SELECT _id, a.coupon_detail_list FROM ikunchi_bi.src_thirdhub_tradesold_jingdong_normal LATERAL VIEW explode( split( regexp_replace( regexp_extract( get_json_object(trade, '$.trade.couponDetailList') -- 獲取data數組,格式[{json},{json}] ,'^\\[(.*?)\\]$' ,1 ) -- 刪除字符串前后的[],格式{json},{json} ,'\\},\\{' , '}||{' , 0 ) -- 將josn字符串中的分隔符代換成||,格式{json}||{json} ,'\\|\\|' ) -- 按||分隔符切割成一個hive數組 ) a as coupon_detail_list )a lateral view json_tuple(a.coupon_detail_list, 'couponPrice', 'couponType', 'orderId', 'skuId' )b AS coupon_price --優惠金額 ,coupon_type --優惠類型 ,order_id --訂單編號 ,sku_id --京東sku編號 ;