简体   繁体   English

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

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

How to convert sample JSON given below to a MT940 txt file:如何将下面给出的示例 JSON 转换为 MT940 txt 文件:

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.这个 JSON 将是一个不好的示例,但希望你能理解它的要点......就像我们有一个库来解析 MT940 字符串/txt 我们也有一个库可以帮助在 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"}]
        }

MT940 is SWIFT message type. MT940 是 SWIFT 消息类型。

Your input is JSON and the output is MT940 text file.您的输入是 JSON 和 output 是 MT940 文本文件。

It is always good to have some java model classes representing your json.有一些 java model 类代表您的 json 总是好的。

  1. Deserialise json input using Jackson to model you gonna use internally.使用 Jackson 将 json 输入反序列化为 model 您将在内部使用。
  2. Use your own library or some third party like https://www.prowidesoftware.com/resources/SWIFT-writer to convert your internal model to MT940使用您自己的库或诸如https://www.prowidesoftware.com/resources/SWIFT-writer 之类的第三方将您的内部 model 转换为 MT940
  3. Serialize the result into text file.将结果序列化为文本文件。

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

相关问题 使用 Elasticsearch 的 Java High Level Rest Client 收到对异步请求的响应后立即返回某些内容 - return something as soon as a response to an async request is received using Elasticsearch's Java High Level Rest Client 将接收到的 JSON 响应转换为 List<T> 在 Java 中 - Convert a received JSON response to List<T> in Java 我如何将我的 json 响应转换为 txt 制表符分隔的文件 rest api java? - how do i convert my json response to a txt tab delimited file rest api java? Java将JSON Rest API响应转换为图像 - Java convert json rest api response to image 如何使用放心将 Json 转换为 Java 以发出 POST 请求 - How to convert Json to Java for making POST request using rest assured Java REST客户端:打印获取请求(json)? - Java REST Client: print get request (json)? 将Java对象转换为XML REST响应 - Convert java object to XML REST response 如何将文本响应绑定到 json 并将 object 放在 micronaut 的声明性客户端上? - How to bind text response to json and put in object on a declarative client on micronaut? 如何检查在休息服务中将 java 对象转换为 json 所花费的时间 - How to check time taken to convert java object to json in rest services 如何将带有JSON对象的“放置”请求发送到Java中的JSONPlaceHolder REST API - How to send a “Put” request with a JSON object to a JSONPlaceHolder REST API in Java
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM