I have Json file like below.
[
{
"id": "29"
"name": "Glenn",
"start": "2024-12-23",
"end": "2025-01-03",
"created": "2024-01-17",
"dates": {
"2024-12-23": "8",
"2024-12-24": "8",
"2024-12-25": "0",
"2024-12-26": "8",
"2024-12-27": "8",
"2024-12-28": "0",
"2024-12-29": "0",
"2024-12-30": "8",
"2024-12-31": "8",
"2025-01-01": "0",
"2025-01-02": "8",
"2025-01-03": "8"
},
"notes": {
"employee": "test1"
}
},
{
"id": "89",
"name": "Jeff",
"start": "2024-12-27",
"end": "2025-01-12",
"created": "2024-04-01",
"dates": {
"2024-12-27": "8",
"2024-12-28": "0",
"2024-12-29": "0",
"2024-12-30": "8",
"2024-12-31": "8",
"2025-01-01": "0",
"2025-01-02": "8",
"2025-01-03": "8",
"2025-01-04": "0",
"2025-01-05": "0",
"2025-01-06": "0",
"2025-01-07": "0",
"2025-01-08": "0",
"2025-01-09": "0",
"2025-01-10": "0",
"2025-01-11": "0",
"2025-01-12": "0"
},
"notes": {
"employee": "test1"
}
}
I am using ADF to load it to structured table.
I am having problem in parsing Dates object
I just need columns id, name, Dates, value
But I am unable to de structure this object, Dates can vary so I can't use pivot or unpivot I tried using string transformation in ADf data flow but couldn't achieve what I want
I tried Converting the object into string and then to Array like below
["2024-12-23":8,"2024-12-24":8,"2024-12-25":0,"2024-12-26":8,"2024-12-27":8,"2024-12-28":0,"2024-12-29":0,"2024-12-30":8,"2024-12-31":8,"2025-01-01":0,"2025-01-02":8.0,"2025-01-03":8]
when I am trying to key: and value: to each element I am unsuccessful
To get you required output you need to use several transformations as below:
Group by
for Id and name column.
Aggregates as datesarray column and values as collect(@(dates=dates))
to convert dates json to array.
OUTPUT: