I want to extract the following json into a table like below. There may be multiple entries under the LIABILITY section so each one will generate a new row. The metrics under the RESPONSE/SUMMARY section will repeat for each one of the LIABILITY entries. I'm not sure how to extract the SUMMARY metric - Right now, I want to designate the NAME (e.g. 'Number of books') I want under DATASET, and pull the corresponding value (e.g., 27)
I am using Microsoft SQL Server
Report ID | File ID | Number of books
123456 ABC01 27
123456 ABC02 27
{
"RESPONSE": {
"@ReportIdentifier": "123456",
"@ReportFirstIssuedDate": "2021-02-12",
},
"LIABILITY": [
{
"@LiabilityID": "TRADE001",
"@BorrowerID": "Borrower01",
"@FileID": "ABC01"
},
{
"@LiabilityID": "TRADE001",
"@BorrowerID": "Borrower01",
"@FileID": "ABC02"
}
],
"SUMMARY": {
"@BorrowerID": "Borrower01",
"@_Name": "Attributes",
"_DATA_SET": [
{
"@_Name": "Number of books",
"@_Value": "27"
},
{
"@_Name": "Average age of borrow",
"@_Value": "35"
},
{
"@_Name": "Number of messages",
"@_Value": "4"
}