2017-11-22 6 views
0

내가처럼 보이는 JSON 출력이로는 어떻게 <strong>// 된 JSONObject/세부</strong> 같은 값을 반복 할 수이 출력에서 ​​WSO2 한 배열 ESB

"details": [ 
     { 
      "id": "", 
      "name": "", 

      "status": "", 

     }, 
     { 
      "id": "", 
      "name": "", 

      "status": "", 

     }, 
     { 
      "id": "", 
      "name": "", 

      "status": "", 

     }, 
     { 
      "id": "", 
      "name": "", 

      "status": "", 

     } 

를 반복자의 모든 JSON 객체를 저장할 및 json-eval('$.details.id') 같은 개별 항목을 가져 오는, 그러나 나는 누군가가 나를 도와 드릴까요, 내가 얻을 출력에서, WSO2 ESB의 배열에 모든 아이디의 이름의를 저장할. 그 도움이된다면

+0

[id : name, id2 : name2, id3 : name3]과 같은 모든 ID와 이름을 저장하고 싶습니다. –

답변

0

는 확실하지, 나는 다음과 같은 pseydo 코드가 그것을 할 수 있다고 생각하지만 난 그것을 시도하지 않았습니다.

//create an empty var 

<property name="newArray" value=""/> 

//iterate over the json 
<iterate xmlns:ns="http://org.apache.synapse/xsd" continueParent="true" expression="//jsonObjects/object" id="MyIterator"> 
.... 
    <property name="newArray" expression="fn:concat(get-property('newArray'),//jsonObjects/object/value)" scope="operation"/> 
    .... 
</iterate> 

<log> 
    <property name="afterIterate" expression="get-property('operation','newArray')"/> 
</log> 
+0

내가 찾은 나는이 시도했지만하지 않은, 작동, 내 생각, 감사합니다 여기에 한 가지 대답 https://stackoverflow.com/questions/42290694/how-to-iterate-json-payload-and-construct- the-response-in-wso2 –