json - 使用 SSIS 将 JSON 文件导入 SQL Server
问题描述
JSON 文件有 2 个部分(嵌套),我可以导入第一个我不知道为什么的部分,对此有什么想法吗?第二部分的第一列NULL
在数据库中显示了我
这是 JSON 文件格式:
我的代码是:
public override void CreateNewOutputRows()
{
/*
Add rows by calling the AddRow method on the member variable named "<Output Name>Buffer".
For example, call MyOutputBuffer.AddRow() if your output was named "MyOutput".
*/
String jsonFileContent = File.ReadAllText(@"C:\Json XLM project SSIS\FileSample.JSON");
JavaScriptSerializer js = new JavaScriptSerializer();
List<Order> orders = js.Deserialize<List<Order>>(jsonFileContent);
foreach (Order order in orders)
{
Output0Buffer.AddRow();
Output0Buffer.TrackingNumber = order.TrackingNumber;
Output0Buffer.LocalReferenceNumber = order.LocalReferenceNumber;
Output0Buffer.TotalShipmentPieces = order.TotalShipmentPieces;
Output0Buffer.TotalShipmentValue = order.TotalShipmentValue;
Output0Buffer.ShipmentCurrency = order.ShipmentCurrency;
Output0Buffer.ShipmentGrossWeight = order.ShipmentGrossWeight;
Output0Buffer.ShipmentNetWeight = order.ShipmentNetWeight;
Output0Buffer.BorderTransportMode = order.BorderTransportMode;
Output0Buffer.ConveyanceDetail = order.ConveyanceDetail;
Output0Buffer.TransportId = order.TransportId;
Output0Buffer.Region = order.Region;
Output0Buffer.WarehouseLocation = order.WarehouseLocation;
Output0Buffer.InvoiceNumber = order.InvoiceNumber;
Output0Buffer.InvoiceDate = order.InvoiceDate;
Output0Buffer.ItemCategoryId = order.ItemCategoryId;
Output0Buffer.InsuredValue = order.InsuredValue;
Output0Buffer.SoldByShipmentPartyAddressId = order.SoldByShipmentPartyAddressId;
}
}
提前致谢。
解决方案
推荐阅读
- ios - 使用 fastlane 运行 xcov 时找不到任何 .xccoverage 文件
- c++ - 在 C++ 中按值迭代?
- php - 如何将一个输入项值传递给另一个输入项?
- python - How to get the average value after grouping by columns?
- c++ - Why does std::sort fail to find the appropriate (static member) function overload?
- python - 如何通过 http 和 https 为 conda/anaconda 配置代理?
- bash - 为变量重新赋值
- java - Hibernate:使用特定字段获取结果
- r - 回归分析中分类变量的符号
- java - Spring Web:替换 org.springframework.web.method.annotation.ModelAttributeMethodProcessor