I have the following JSON and expecting a table out of it.
{
"Response": [
{
"questionId": 1,
"answer": [
"5","6"
]
},
{
"questionId": 2,
"answer": [
"5"
]
}
]
}
And the expected table...
I tried with the following, but didn't the exact output that i'm looking for.
SELECT QuestionId,Answer FROM OPENJSON(@responseJson, N'$.Response') r
CROSS APPLY OPENJSON (r.value) WITH ( QuestionId varchar(200) '$.questionId', Answer nvarchar(max) '$.answer')