英文:
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模型类始终是很好的。
- 使用Jackson对JSON输入进行反序列化,以便建立内部使用的模型。
- 使用您自己的库或第三方库(例如https://www.prowidesoftware.com/resources/SWIFT-writer)将您的内部模型转换为MT940。
- 将结果序列化为文本文件。
英文:
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.
- Deserialise json input using Jackson to model you gonna use internally.
- Use your own library or some third party like https://www.prowidesoftware.com/resources/SWIFT-writer to convert your internal model to MT940
- Serialize the result into text file.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论