简体   繁体   English

Json 数据在 informatica 开发人员中的 java 转换中解析为表

[英]Json data parse into table in java transformation in informatica developer

I have data in below format-我有以下格式的数据-

{
"result": [
    {
        "number": "C12",
        "name": "ABC"
    },
    {
        "number": "D12",
        "name": "BCD"
       
    },
    {
        "number": "E56",
        "name": "fm"
     }]
}

My code is -我的代码是 -

String result = //that store my above json data;
try{
    String jsonString = result;
    JSONObject obj = new JSONObject(jsonString);
    JSONArray arr = obj.getJSONArray("result");
    for (int i = 0; i < arr.length(); i++)
     {
        String num = arr.getJSONObject(i).getString("number");
        String name= arr.getJSONObject(i).getString("name");
        generateRow();
     }
   }
 catch(Exception e)
  {
        e.printStackTrace(); 
  }

But with this code i am able to read only first record.但是使用此代码,我只能读取第一条记录。

Please help in writing the code where i can read all the records.请帮助编写我可以读取所有记录的代码。

You can move to Informatica developer tool in case you have the license and use H2R transformation如果您拥有许可证并使用 H2R 转换,则可以迁移到 Informatica 开发人员工具

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

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