I am trying to read a json array into a table, one of the nodes (Languages) in the array is an array in itself, and I am getting null for this particular column (Languages).
Below is the sample json:
DECLARE @json NVARCHAR(MAX) = '[
{
"Id":1,
"Name":"Test1",
"Languages":["L1", "L2"]
},
{
"Id":2,
"Name":"Test2",
"Languages":["L3", "L4"]
},
{
"Id":3,
"Name":"Test2",
"Languages":["L5", "L6"]
}]'
Below is the query I am using:
SELECT Id
, Name
, Languages
FROM OPENJSON(@json)
WITH (Id INT '$.Id'
, Name VARCHAR(20) '$.Name'
, Languages VARCHAR(200) '$.Languages')
Below is the current result:
However I need the result as below
What am I doing wrong? Please help.


