Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejavascript
{"array":[1,2]}

XML (RJsonStreamBuilder):

Code Block
languagehtml/xml
<jsonObject>
   <array>1</array>
   <array>2</array>
</jsonObject>

XML (JsonBuilder):

Code Block
languagehtml/xml
<jsonObject>
   <?xml-multiple array?>
   <array>1</array>
   <array>2</array>
</jsonObject>

...

Code Block
languagejavascript
{"array":[]}

XML (RJsonStreamBuilder):

Code Block
languagehtml/xml
<jsonObject></jsonObject>

XML (JsonBuilder):

Code Block
languagehtml/xml
<jsonObject>
   <?xml-multiple array?>
</jsonObject>

...

Code Block
languagejavascript
[1,2]

XML (RJsonStreamBuilder):

Code Block
languagehtml/xml
<jsonArray>
   <jsonElement>1</jsonElement>
   <jsonElement>2</jsonElement>
</jsonArray>

XML (JsonBuilder):

Code Block
languagehtml/xml
<jsonArray>
   <?xml-multiple jsonElement?>
   <jsonElement>1</jsonElement>
   <jsonElement>2</jsonElement>
</jsonArray>

...

Code Block
languagejavascript
[1, []]

XML (RJsonStreamBuilder):

Code Block
languagehtml/xml
<jsonArray>
   <jsonElement>1</jsonElement>
   <jsonElement>
       <jsonArray></jsonArray>
   </jsonElement>
</jsonArray>

XML (JsonBuilder):

Code Block
languagehtml/xml
<jsonArray>
   <?xml-multiple jsonElement?>
   <jsonElement>1</jsonElement>
   <jsonElement>
       <jsonArray>
           <?xml-multiple jsonElement?>
       </jsonArray>
   </jsonElement>
</jsonArray>

...

Code Block
languagehtml/xml
linenumberstrue
<proxy xmlns="http://ws.apache.org/ns/synapse"
     name="singleresponse"
     transports="https,http"
     statistics="disable"
     trace="disable"
     startOnLoad="true">
     <target>
         <outSequence>
             <payloadFactory media-type="json">
                 <format>{
                             "location_response" : {
                                 "name" : "$1",
                                 "tags" : $2
                         }}
                 </format>
                 <args>
                     <arg evaluator="json" expression="$.name"/>
                     <arg evaluator="json" expression="$.types"/>
                 </args>
             </payloadFactory>
             <send/>
         </outSequence>
         <endpoint>
             <address uri="http://localhost:828018280/location"/>
         </endpoint>
     </target>
 <description/>
</proxy>

...

Code Block
languagehtml/xml
linenumberstrue
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="locations"
       transports="https,http"
       statistics="disable"
       trace="disable"
       startOnLoad="true">
   <target>
      <outSequence>
         <script language="js"
                 key="conf:/repository/esb/transform.js"
                 function="transform"/>
         <send/>
      </outSequence>
      <endpoint>
         <address uri="http://localhost:828018280/locations"/>
      </endpoint>
   </target>
   <description/>
</proxy>

...

For additional examples that demonstrate different ways to manipulate JSON payloads within the ESB mediation flow, see the following samples:

...

Anchor
troubleshooting
troubleshooting

...