```
select
JT.*
FROM
JSON_TABLE (json_sample)
'$.general[*]'
COLUMNS (
product_key NUMBER PATH '$.product_key',
group_subtype_id NUMBER PATH '$.group_subtype_id',
group_subtype_name VARCHAR2 ( 100 ) PATH '$.group_subtype_name',
variant_id NUMBER PATH '$.variant_id',
variant_name VARCHAR2 ( 100 ) PATH '$.variant_name',
rb_customer_id NUMBER PATH '$.rb_customer_id',
NESTED PATH '$.partnumbers[*]'
COLUMNS (
partnumber VARCHAR2 ( 100 ) PATH '$.partnumber',
pn_type VARCHAR2 ( 100 ) PATH '$.pn_type',
mat_status VARCHAR2 ( 100 ) PATH '$.mat_status',
base_wire_esd VARCHAR2 ( 10 ) PATH '$.properties[0].value',
pressure VARCHAR2 ( 10 ) PATH '$.properties[1].value',
NESTED PATH '$.document_numbers[*]'
COLUMNS (
document_number VARCHAR2 ( 100 ) PATH '$.document_number',
document_verion NUMBER PATH '$.document_verion',
document_type VARCHAR2 ( 100 ) PATH '$.document_type',
NESTED PATH '$.target_markets[*]'
COLUMNS (
country_name VARCHAR2 ( 100 ) PATH '$.country_name',
iso_code VARCHAR2 ( 10 ) PATH '$.iso_code',
NESTED PATH '$.hierarchy_information[*]'
COLUMNS (
child_product NUMBER PATH '$'
)
)
)
)
)
)
jt
```
Sample JSON:
”’ {
"general": {
"product_key": "136587",
"group_subtype_id": 1,
"group_subtype_name": "Wheel Speed Sensor",
"variant_id": 2,
"variant_name": "DF11",
"rb_customer_id": 16732
},
"partnumbers": [
{
"partnumber": "0265009953",
"pn_type": "Series OEM",
"mat_status": "40 – Valid",
"properties": [
{
"property_id": 4,
"property_name": "ASIC P/N",
"value_id": 27,
"value": "8905509055"
},
{
"property_id": 5,
"property_name": "ASIC type",
"value_id": 56,
"value": "TLE4942"
},
{
"property_id": 6,
"property_name": "Axle",
"value_id": 64,
"value": "Front"
},
{
"property_id": 7,
"property_name": "Base Type – Development P/N",
"value_id": null,
"value": null
},
{
"property_id": 8,
"property_name": "Base Type – Released P/N",
"value_id": 73,
"value": "F00C1B0037"
},
{
"property_id": 9,
"property_name": "Bracket assembly @ Bosch",
"value_id": null,
"value": null
},
{
"property_id": 10,
"property_name": "Bulk cable P/N",
"value_id": null,
"value": null
},
{
"property_id": 11,
"property_name": "Cable assembly P/N1",
"value_id": null,
"value": null
},
{
"property_id": 12,
"property_name": "Cable assembly P/N2",
"value_id": null,
"value": null
},
{
"property_id": 13,
"property_name": "Cable assembly P/N3",
"value_id": null,
"value": null
},
{
"property_id": 14,
"property_name": "Cable Length in mm",
"value_id": null,
"value": null
},
{
"property_id": 15,
"property_name": "Cable/Connector Outlet in Deg",
"value_id": 110,
"value": "Axial"
},
{
"property_id": 16,
"property_name": "Character",
"value_id": 136,
"value": "Crimped"
},
{
"property_id": 17,
"property_name": "Clip assembly Bosch",
"value_id": null,
"value": null
},
{
"property_id": 18,
"property_name": "Connector P/N",
"value_id": null,
"value": null
},
{
"property_id": 19,
"property_name": "Connector Type",
"value_id": null,
"value": null
},
{
"property_id": 20,
"property_name": "Development P/N",
"value_id": 141,
"value": "0265BU2370"
},
{
"property_id": 21,
"property_name": "Function Dimension",
"value_id": 142,
"value": "3"
},
{
"property_id": 22,
"property_name": "IC Angle in Deg",
"value_id": 143,
"value": "-90"
},
{
"property_id": 23,
"property_name": "Marking",
"value_id": null,
"value": null
},
{
"property_id": 24,
"property_name": "Offer drawing",
"value_id": 145,
"value": "0265AU2370"
},
{
"property_id": 25,
"property_name": "O-ring P/N",
"value_id": null,
"value": null
},
{
"property_id": 26,
"property_name": "Pitch",
"value_id": 166,
"value": "14"
},
{
"property_id": 27,
"property_name": "Project category",
"value_id": null,
"value": null
},
{
"property_id": 28,
"property_name": "Protocol",
"value_id": 170,
"value": "i"
},
{
"property_id": 29,
"property_name": "Reading Dimension",
"value_id": 173,
"value": "36.5"
},
{
"property_id": 30,
"property_name": "Reading type",
"value_id": 185,
"value": "Side Read"
},
{
"property_id": 31,
"property_name": "Recommended Installation Bore Ã?",
"value_id": 191,
"value": "10"
},
{
"property_id": 32,
"property_name": "Target wheel",
"value_id": 193,
"value": "Multipole encoder"
},
{
"property_id": 33,
"property_name": "Used punch grid holder",
"value_id": 194,
"value": "F00C1F8441"
}
]
}
],
"document_numbers": [],
"target_markets": [],
"hierarchy_information": {
"child_products": []
}
} ”’
need to parse this json sample into tables
The code above can get only the info under general into the table
But the child details like partnumbers and its properities are not getting parsed
2
Answers
You are nesting paths when you should not as they are not children of
$.general
:Outputs:
fiddle