Thanks, @filipniziol
I realized CRates are arrays. I guess I have to use another function and add one more layer, right?
CREATE TABLE unpivot_valtype AS
SELECT parse_json(
'{
"Id": 1234567,
"Result": {
"BodyType": "NG",
"ProdType": "Auto",
"ResultSets": [
{
"R1": {
"AInt": 1,
"CRates": [
{
"RateA": 11,
"RateB": 12,
"RateC": 13
},
{
"RateA": 111,
"RateB": 112,
"RateC": 113
}]
,
"EffPrice": 14,
"EffRate": 15
},
"R2": {
"AInt": 2,
"CRates": [
{
"RateA": 21,
"RateB": 22,
"RateC": 23
},
{
"RateA": 221,
"RateB": 222,
"RateC": 223
}]
,
"EffPrice": 24,
"EffRate": 25
},
"R3": {
"AInt": 3,
"CRates": [
{
"RateA": 31,
"RateB": 32,
"RateC": 33
},
{
"RateA": 331,
"RateB": 332,
"RateC": 333
}]
,
"EffPrice": 34,
"EffRate": 35
} } ]
}
}') as rowData