User Guide > Views and Table Resources > Working with Views and JSON > Using a JSON Table Within a TDV View
 
Using a JSON Table Within a TDV View
When using the JSON_TABLE syntax in a view, you can define the structure and the data.
To add and use a JSON table within a TDV View
1. Add the JSON_TABLE SQL function with the data and structure definitions to the SQL tab of your view.
For example, the JSON table could have:
FROM JSON_TABLE('{
"company": {
"department": [
{
"DepartmentID": 1,
"DepartmentName" : "Sales"
},
{
"DepartmentID": 2,
"DepartmentName" : "Project"
},
{ "DepartmentID": 3,
"DepartmentName" : "Market"
},
{ "DepartmentID": 4,
"DepartmentName" : "HR"
}
]
}}',
'$.company.department'
 
2. From within this view you can now use standard SQL functions to manipulate the composite view.