I am now importing JSON data into a SQL Server table where the JSON data is stored as a single column entry.
I now have a more complex JSON structure and I am having difficulty with the path in the OPENJSON statement
I tried creating table results modifying an existing OPENJSON that was pointed out to me.
However this path I can not get the data to appear (the command does complete successfully)
What is incorrect in my path that I am not retrieving the data for **timestamp and value?**
SELECT t.[DATE], j.*
FROM DTReport.Json_synthetic_response_time t
CROSS APPLY OPENJSON(t.log, '$.metrics."builtin:synthetic.browser.visuallyComplete.load".series[2]') WITH (
[Timestamp] bigint '$[0]',
[Value] float '$[1]'
) j
Here is the JSON file (with several data points removed for brevity)
{
"totalCount":1,
"nextPageKey":null,
"metrics":{
"builtin:synthetic.browser.visuallyComplete.load":{
"series":[
{
"dimensions":[
"SYNTHETIC_TEST-434A9DE59A6CAFD6"
],
"values":[
{
"timestamp":1571691600000,
"value":2978.5833333333335
},
{
"timestamp":1571702400000,
"value":3129.6666666666665
},
{
"timestamp":1571713200000,
"value":3040.6666666666665
},
{
"timestamp":1571724000000,
"value":3132.1666666666665
},
{
"timestamp":1572901200000,
"value":2727.2727272727275
}
]
}
]
}
}
}