when writing the CSV file it does not have the values red
and small
Example:
imput jsonFile:
[
{
"id": 1,
"name": "Mike",
"features": {
"colors": [
"blue"
],
"sizes": [
"big"
]
}
},
{
"id": 1,
"name": "Jose",
"features": {
"colors": [
"blue",
"red"
],
"sizes": [
"big",
"small"
]
}
}
]
output csvFile:
id;name;features_colors_0;features_sizes_0
1;Mike;blue;big
1;Jose;blue;big
Code:
using ChoETL;
using System.IO;
namespace TestJsonToCsv
{
class Program
{
static void Main(string[] args)
{
var jsonPath = @"C:\Users\xxx\Downloads\test_array.json";
var csvPath = Path.ChangeExtension(jsonPath, "csv");
var config = new ChoJSONRecordConfiguration();
config.Encoding = System.Text.Encoding.UTF8;
using (var r = new ChoJSONReader(jsonPath, config))
{
using (var w = new ChoCSVWriter(csvPath).WithFirstLineHeader())
{
w.Write(r);
}
}
}
}
}
Library version:
ChoETL - 1.2.1.14
ChoETL.JSON - 1.2.1.14
issue reference - https://github.com/Cinchoo/ChoETL/issues/138