Jump to content
We have recently updated our Privacy Statement, available here ×
  • BW5.X - How to parse JSON messages with extra fields or fields in an unexpected order in BusinessWorks 5.X

    The REST / JSON plugin available for BusinessWorks 5.X is convenient to parse JSON documents to transform them into XML structures that can be later used in Mappings, it also allows to create JSON documents by rendering XML structures.

    That said a constraint using the Parse JSON activity is that the activity expect the JSON message to match exactly the corresponding XML schema definition, this include the following points:

    . The activity expect the fields of the JSON message to be in the exact same order than the XML elements definitions in the corresponding XML schema

    . The activity won’t accept any extra fields, in other words fields that would not be defined as XML elements in the XML Schema

    While this is perfectly valid for JSON documents to have fields in any order and to have extra fields there is a solution in BusinessWorks 5.X to manage such scenario and this article is to present it.

    Note that in BusinessWorks 6.X and BusinessWorks Container Edition there is no constraint on the field order and extra fields can be ignored with an option (starting from BusinessWorks 6.6.1).

    The solution is the following:

    . Configure the Parse JSON activity with the Validate Output option unchecked


    . Add a Mapper activity after the Parse JSON activity and configure it to use as Input the XML schema that is already used to define the Output of the Parse JSON activity


    . Map the output of the Parse JSON activity to the input of the Mapper using the ‘Auto-Map’ feature of the Mapper, like below:


    Make sure that fields are mapped one by one at all levels (in other words make sure there is no ‘Copy Of’ in the mapping).

    . The output of the mapping is now a valid XML structure that can be used in later mappings

    Additional elements

    You can refer to the attached project.

    JSON any order demo BW 5.X.zip

    User Feedback

    Recommended Comments

    There are no comments to display.

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now

  • Create New...