How to convert JSON object received in response to REST Client request to a MT940 Swift text file in Java?

huangapple go评论57阅读模式
英文:

How to convert JSON object received in response to REST Client request to a MT940 Swift text file in Java?

问题

以下是您要翻译的内容:

如何将以下给定的示例JSON转换为MT940 txt文件:

这个JSON示例不太好,但希望您能理解大致的意思...
就像我们有一个库可以解析MT940字符串/文本一样,我们也有一个库可以在Java中帮助构建MT940 txt文件。

{
  "accNumber":"123356",
  "openBalInd":"D",
  "openBalaDate":"200605",
  "curr":"Dollar",
  "transactions":[
        {
         "amount":"434",
         "credit/debit":"1000",
         "datetime":"20042020"
        },
        {
         "amount":"434",
         "credit/debit":"1000",
         "datetime":"20042020"}
        }]
}
英文:

How to convert sample JSON given below to a MT940 txt file:

This JSON would be a bad sample to show but hope you get the gist of it...
Just like we have a library in place to parse MT940 strings/txt we also have a library which can help construct a MT940 txt file in Java.

{
  "accNumber":"123356",
  "openBalInd":"D",
  "openBalaDate":"200605",
  "curr":"Dollar",
  "transactions":[
        {
         "amount":""434,
         "credit/debit":"1000",
         "datetime":"20042020"
        },
        {
         "amount":""434,
         "credit/debit":"1000",
         "datetime":"20042020"}]
        }

答案1

得分: 1

MT940是SWIFT消息类型。

您的输入是JSON,输出是MT940文本文件。

拥有一些代表您的JSON的Java模型类始终是很好的。

  1. 使用Jackson对JSON输入进行反序列化,以便建立内部使用的模型。
  2. 使用您自己的库或第三方库(例如https://www.prowidesoftware.com/resources/SWIFT-writer)将您的内部模型转换为MT940。
  3. 将结果序列化为文本文件。
英文:

MT940 is SWIFT message type.

Your input is JSON and the output is MT940 text file.

It is always good to have some java model classes representing your json.

  1. Deserialise json input using Jackson to model you gonna use internally.
  2. Use your own library or some third party like https://www.prowidesoftware.com/resources/SWIFT-writer to convert your internal model to MT940
  3. Serialize the result into text file.

huangapple
  • 本文由 发表于 2020年8月17日 21:36:23
  • 转载请务必保留本文链接:https://go.coder-hub.com/63451975.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定