Mulesoft将多个JSON / XML转换为CSV

时间:2019-08-30 02:48:57

标签: mule dataweave mulesoft

我对在Mulesoft中将JSON转换为CSV完全陌生。目前,我需要将嵌套的JSON转换为CSV,而我的CSV应该像这样CSV,而JSON就像

{
  "Invoice": [
    {
      "Invoice Number*": "",
      "Supplier Name": "",
      "Supplier Number": "",
      "Status": "",
      "Invoice Date*": ""
    }
  ],
  "Invoice Line": [
    {
      "Invoice Number*": "",
      "Supplier Name": "",
      "Supplier Number": "",
      "Line Number": "",
      "Description*": "",
      "Supplier Part Number": "",
      "Auxiliary Part Number": "",
      "Price*": "",
      "Quantity": "",
      "Bulk Price": "",
      "Bulk Price Qty": ""
    }
  ],
  "Invoice Tax Line": [
    {
      "Invoice Number*": "",
      "Invoice Line Number": "",
      "Invoice Charge Number": "",
      "Line Number": "",
      "Tax Amount": "",
      "Tax Rate": "",
      "Tax Code": "",
      "Tax Rate Type": ""
    }
  ]
}

我对CSV的了解是只有一个标题。将这种复杂的JSON映射到CSV文件(显示不同的标头)的最佳方式是什么?

1 个答案:

答案 0 :(得分:4)

您可以执行以下操作:

Database Server