I am a newbie to ADL & JSON files. I am trying to load a JSON file into an ADL table.
My JSON file structure is
{ABCD:{Time:"", Date:"", ProcessingTime:"", ProcessName:""}},
{ABCD:{Date:"", ProcessingTime:"", ProcessName:""}},
{ABCD:{ProcessingTime:"", ProcessName:""}},
{ABCD:{Time:"", Date:"", ProcessingTime:"", ProcessName:""}},
My table has all the 4 columns (Time, Data, ProcessingTime, & ProcessName).
First, I tried writing it to a CSV file using USQL statements before writing it into a table. But, the CSV output got generated with all blank records.
Any help is appreciated. Can I do this through ADF as well? I would like to have this as a scheduled job.
Below is the USQL code I used to write the CSV file.
CREATE ASSEMBLY IF NOT EXISTS [Newtonsoft.Json] FROM
"C:/Test/Assemblies/Newtonsoft.Json.dll";
CREATE ASSEMBLY IF NOT EXISTS [Microsoft.Analytics.Samples.Formats] FROM
"C:/ADL/Assemblies/Microsoft.Analytics.Samples.Formats.dll";
REFERENCE ASSEMBLY [Newtonsoft.Json];
REFERENCE ASSEMBLY [Microsoft.Analytics.Samples.Formats];
USING Microsoft.Analytics.Samples.Formats.Json;
DECLARE @path string = @"C:\Test\";
DECLARE @input string = @path + @"sample_data1.json";
DECLARE @to string = @path + @"output.csv";
@jsonFile =
EXTRACT
Time string,
Date string,
ProcessingTime string,
ProcessName string
FROM @input
USING new JsonExtractor();
OUTPUT @jsonFile
TO @to
USING Outputters.Csv();
Cheers!