简体   繁体   English

在 anypoint studio 中使用 Dataweave 将 Excel 转换为 JSON

[英]Converting Excel to JSON using Dataweave in anypoint studio

Need to transform Excel to JSON using Dataweave in Anypoint Studio.需要在 Anypoint Studio 中使用 Dataweave 将 Excel 转换为 JSON。

Mule Datamapper supports converting Excel files to JSON directly,where as in DataWeave it won't support Excel to JSON conversion. Mule Datamapper 支持直接将 Excel 文件转换为 JSON,而在 DataWeave 中它不支持 Excel 到 JSON 的转换。

In a blog i found that using POI libraries we can do this but it is a bit complex work.在一篇博客中,我发现使用 POI 库我们可以做到这一点,但工作有点复杂。

Is there any alternative way to do this?有没有其他方法可以做到这一点?

Excel (XLSX files) support for DataWeave (the data transformation processor) has been released with the new Anypoint Studio 6.1.2 version w/3.8.2 Runtime. Excel(XLSX 文件)对DataWeave (数据转换处理器)的支持已随新的 Anypoint Studio 6.1.2 版本 w/3.8.2 Runtime 一起发布。

Please see how to use it here: Excel format in DataWeave请在此处查看如何使用它: DataWeave 中的 Excel 格式

And the release notes below:以及下面的发行说明:
https://docs.mulesoft.com/release-notes/anypoint-studio-6.1-with-3.8.2-runtime-update-site-2-release-notes https://docs.mulesoft.com/release-notes/anypoint-studio-6.1-with-3.8.2-runtime-update-site-2-release-notes

I don't think there is any Excel transformer in 3.7 unless you want to use DataMapper which is deprecated.我认为 3.7 中没有任何 Excel 转换器,除非您想使用已弃用的 DataMapper。 Yes, some work but you can use Apache POI like below -是的,有些工作,但您可以使用 Apache POI,如下所示 -

  1. Convert Excl to CSV using Java Transformer - I found this apache sample generic class here使用 Java Transformer 将 Excl 转换为 CSV - 我在这里找到了这个 apache 示例通用类
  2. Now, Once you have the CSV, send that to DataWeave and do your CSV to JSON transformation.现在,获得 CSV 后,将其发送到 DataWeave 并进行 CSV 到 JSON 的转换。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM