C# - Writing JSON to Parquet file does not work with nested json

349 Views Asked by At

I am trying to convert JSON data to parquet file. Below is my input.

{"time": 1637045320491, "device": {"type_id": 1}, "message": "Test message", "metadata": {"product": {"name": "prodName", "vendor_name": "XYZ"}, "version": "1.0.0", "original_time": "2021-11-16T12:18:40.491893+05:30"}, "tuid": 900201, "cluid": 9002, "activity_id": 1, "severity_id": 4, "cuid": 9}

My output does not show properly as a nested json. Instead it shows as below.

{"time":1637045320491,"device_type_id":1,"message":"Test message","metadata_product_name":"prodName","metadata_product_vendor_name":"XYZ","metadata_version":"1.0.0","metadata_original_time":24520491893000,"tuid":900201,"cluid":9002,"activity_id":1,"severity_id":4,"cuid":9}

Can someone help me get the output the same as the json. I'm using ChoETL package to convert to Parquet file.

var pqFile = @"D:\Data\" + Guid.NewGuid() + ".parquet";
using (var r = new ChoJSONReader(@"D:\Data\json-dump.json"))
{
    using (var w = new ChoParquetWriter(pqFile))
    {
         w.Write(r);
    }
}
0

There are 0 best solutions below