I have trawled the internet for the past two days without success so reluctantly here is my first question to the good people of Stack Overflow.
I am trying to transform JSON data to a SQL Server (2016) table but the data contains an array with no key. The JSON looks like so:
[
{
"year": 2016,
"month": 1,
"day": 1,
"breakdownTotal": [
"283082",
"601184",
"140120"
]
},
{
"year": 2016,
"month": 1,
"day": 2,
"breakdownTotal": [
"354725",
"760532",
"177279"
]
}
]
I can get the following table:
year month day
2016 1 1
2016 1 2
But ideally I would like to have:
year month day breakdown1 breakdown2 breakdown3
2016 1 1 283082 601184 140120
2016 1 2 354725 760532 177279
Though would be able to do something with:
year month day breakdown
2016 1 1 283082
2016 1 1 601184
2016 1 1 140120
2016 1 2 354725
2016 1 2 760532
2016 1 2 177279
This is similar to the example data at the top of this link: [https://msdn.microsoft.com/en-gb/library/dn921897.aspx][1] [1]: https://msdn.microsoft.com/en-gb/library/dn921897.aspx though unhelpfully, these is no mention of how to extract the info.
Does anybody have any tips on how I could achieve the desired result? Any help would be much appreciated.
Rob