Friday, July 17, 2026

#1154 - OIC 26.07 - Support for Dynamic JSON

Introduction

So what do we mean here by dynamic JSON? 

Here's a very simple example of such - I have an integration that processes product returns. The trigger request payload is as follows - 

Now I need to add support for possible extra fields such as product
I've clicked Allow Dynamic JSON and have defined the response as follows - 

Let's misuse the status field and fill it with the product value.

Here I need to edit the XSLT in the Mapper. First, let's map the orderNr to status - 

Check out the XSLT - 

  <ns14:response-wrapper>
                          <ns14:status>
                                <xsl:value-of select="/nstrgmpr:execute/ns14:request-wrapper/ns14:details/ns14:orderNr"/>
                          </ns14:status>
                    </ns14:response-wrapper>




Now I edit the value-of as follows - 

 <ns14:response-wrapper>
                          <ns14:status>
                                <xsl:value-of select="/nstrgmpr:execute/ns14:request-wrapper/ns14:details/*[local-name()='product']"/>
                          </ns14:status>
                    </ns14:response-wrapper>

Note the format I need to use. Now let's try this in a Switch action. I need to log the product value, if it is present. 

Here I use - string-length(/ns13:execute/ns10:request-wrapper/ns10:details/*[(local-name() = 'product')]) > 0

The Logger action is configured as follows - 


/ns13:execute/ns10:request-wrapper/ns10:details/*[(local-name() = 'product')]



Let's run the integration - run with no product field - 

Run with product field - 

I check the Switch







 


No comments: