C# Cinchoo ETL json到csv

C# Cinchoo ETL json到csv,c#,json,csv,etl,choetl,C#,Json,Csv,Etl,Choetl,我正在尝试将json格式化为csv文件 下面是数据结构的 public class Location { [JsonProperty("latitude")] public double Latitude { get; set; } [JsonProperty("longitude")] public double Longitude { get; set; } } public class Monitor {

我正在尝试将json格式化为csv文件

下面是数据结构的

public class Location
{
    [JsonProperty("latitude")]
    public double Latitude { get; set; }

    [JsonProperty("longitude")]
    public double Longitude { get; set; }
}

public class Monitor
{
    [JsonProperty("channelId")]
    public int ChannelId { get; set; }

    [JsonProperty("name")]
    public string Name { get; set; }

    [JsonProperty("alias")]
    public string Alias { get; set; }

    [JsonProperty("active")]
    public bool Active { get; set; }

    [JsonProperty("typeId")]
    public int TypeId { get; set; }

    [JsonProperty("pollutantId")]
    public int PollutantId { get; set; }

    [JsonProperty("units")]
    public string Units { get; set; }

    [JsonProperty("description")]
    public string Description { get; set; }
}

public class StationCall
{
    [JsonProperty("stationId")]
    public int StationId { get; set; }

    [JsonProperty("name")]
    public string Name { get; set; }

    [JsonProperty("shortName")]
    public string ShortName { get; set; }

    [JsonProperty("stationsTag")]
    public string StationsTag { get; set; }

    [JsonProperty("location")]
    public Location Location { get; set; }

    [JsonProperty("timebase")]
    public int Timebase { get; set; }

    [JsonProperty("active")]
    public bool Active { get; set; }

    [JsonProperty("owner")]
    public string Owner { get; set; }

    [JsonProperty("regionId")]
    public int RegionId { get; set; }

    [JsonProperty("monitors")]
    public Monitor[] Monitor { get; set; }

    [JsonProperty("StationTarget")]
    public string StationTarget { get; set; }

    [JsonProperty("additionalTimebases")]
    public string AdditionalTimebases { get; set; }

    [JsonProperty("isNonContinuous")]
    public string IsNonContinuous { get; set; }

    public static string fileName = "stations.txt";
  
   
}
问题在于csv结果中,类监视器的格式不正确

StationId、Name、ShortName、StationsTag、Location.纬度、Location.经度、时基、活动、所有者、RegionId、监视器、StationTarget、附加时基是不连续的 63,米苏希姆,米苏希姆,00.0000,00.3583,60,真,无,16,“Sfika_应用程序实体。监视器,Sfika_应用程序实体。监视器,Sfika_应用程序实体。监视器,Sfika_应用程序实体。监视器”,无

使用软件包:

 using (var parser = new ChoCSVWriter<StationCall>("D:/Export.csv").WithFirstLineHeader().UseNestedKeyFormat(true))
        {
            //parser.with
            parser.Write(jsonContent);
        }
使用(var parser=new ChoCSVWriter(“D:/Export.csv”).WithFirstLineHeader().UseNestedKeyFormat(true))
{
//语法分析器
Write(jsonContent);
}

我做错了什么?

您需要用
RangeAttribute
装饰
监视器
属性,以指定可能的预期数组范围

public class StationCall
{
    [JsonProperty("stationId")]
    public int StationId { get; set; }

    [JsonProperty("name")]
    public string Name { get; set; }

    [JsonProperty("shortName")]
    public string ShortName { get; set; }

    [JsonProperty("stationsTag")]
    public string StationsTag { get; set; }

    [JsonProperty("location")]
    public Location Location { get; set; }

    [JsonProperty("timebase")]
    public int Timebase { get; set; }

    [JsonProperty("active")]
    public bool Active { get; set; }

    [JsonProperty("owner")]
    public string Owner { get; set; }

    [JsonProperty("regionId")]
    public int RegionId { get; set; }

    [JsonProperty("monitors")]
    [Range(0, 1)]
    public Monitor[] Monitor { get; set; }

    [JsonProperty("StationTarget")]
    public string StationTarget { get; set; }

    [JsonProperty("additionalTimebases")]
    public string AdditionalTimebases { get; set; }

    [JsonProperty("isNonContinuous")]
    public string IsNonContinuous { get; set; }

    public static string fileName = "stations.txt";
  
   
}

谢谢,可以了,但是如果我不知道数组的长度呢?