API Enablement

JSON array parsing while using Z/OS Connect - appending operators in the request received

  • 1.  JSON array parsing while using Z/OS Connect - appending operators in the request received

    Posted Fri July 21, 2023 12:05 PM

    Hi Team,

     

    Hope all are doing good.

     

    I am trying to use Z/OS Connect Enterprise edition - my requirement is to parse the JSON data sent in array and add operators like"=" , "OR" , "AND" in between the data fields using PLI programming language.

     

    The request data will be scanned for delimiters and they will be replaced with corresponding operators , could someone suggest if there is any IBM utility to parse JSON data , append data in between the request data and use it accordingly for business conditions.

     

    Request Sent

     

    { {  EMP_ID:'abc',EMP_NAME:'abc',EMP_NO:'20',EMP_REG:[1,4,5,6],EMP_status:'X'},
      {  EMP_ID:'xyz',EMP_NAME:'acd',EMP_NO:'10',EMP_REG:[9,10],EMP_status:'X'},
          …
          ….
                                                               … }

     

    Request received using Z/OS connect - after parsing , data appending in PLI program - the below will be passed in where clause to filter the DB2 table.

     

    { {  EMP_ID='abc' AND EMP_NAME='abc' AND EMP_NO='20' AND EMP_REG=[1,4,5,6] AND EMP_status='X'} OR
      {  EMP_ID='xyz' AND EMP_NAME='acd' AND EMP_NO='10' AND EMP_REG=[9,10] AND EMP_status='X'} OR
          …}



    ------------------------------
    Sharmila Gunasekaran
    ------------------------------