在WSO2 EI中转换JSONArray值

问题描述 投票:0回答:1

我在wso2 EI中有一些中介期间的转换逻辑”。我在“ @ type”:“ Lead”转换为“ attributes”:{“ type”:“ Lead”}转换时陷入困境。

注:我知道要使用payloadfactory实现此功能(预期格式)。在getFields Array下收到了至少1000个JSONObject。

输入:

{
"getDataResponse":{
    "result":{
        "DataSyncTime":"sometime",
        "getFields":[
            {
                "@type":"Lead",
                "FirstName":"Justin"
            },
            {
                "@type":"Lead",
                "FirstName":"Manoj"
            }
          //received atleast 1000 records ie jsonobject here(Dynamic)
            ],
            "Message" :"Text messsage",
            "Success":200
    }
}

}

期望:

{
    "DataSyncTime":"sometime",
    "getEvents":[],
    "getFields":[
            {
                "attributes":{"type":"Lead"},
                "FirstName":"Justin"
            },
            {
                "attributes":{"type":"Lead"},
                "FirstName":"Manoj"
            }

            ],
            "getTask":[],
            "Message" :"Text messsage",
            "Success":200
}
arrays json wso2esb transformation wso2ei
1个回答
0
投票

尝试将Foreach介体与Payload Factory介体一起使用以遍历阵列。如果有效负载工厂不满足您的要求,则可能必须使用“自定义类”调解器来满足您的要求。

© www.soinside.com 2019 - 2024. All rights reserved.