Layer7 API Management

  • 1.  json respone to append with a key value

    Posted Jul 10, 2018 05:30 PM

    Hi There,

    When a client requests a service from the backend service I receive the below sample response, after receiving that first response I want to add one more attribute at the end of the response such see the second part and want to send it to the client. How can I perform it?

    The first part of the response:

    {
    "username": "test@gmail.com",
    "laguage": "en",
    "type= : "lob"
    }

     

    Final respone to send back with addintonal attribute.

    {
    "username": "test@gmail.com",
    "laguage": "en",
    "type= : "lob",

    "APIG" : "Dev"
    }



  • 2.  Re: json respone to append with a key value
    Best Answer

    Broadcom Employee
    Posted Jul 10, 2018 07:23 PM

    There could be multiple ways.

    1. regular expression (find last node and replace as last node+new node)

    2. transform to xml, use xslt, or add element assertion to add new node, and then transform back to json

    3. json path assertion to get each node, and then compose new json document with existing nodes and new node.

     

    Regards,

    Mark



  • 3.  Re: json respone to append with a key value

    Posted Jul 20, 2018 09:28 PM

    Vote for Javascript execution in policy !!

    Right now the CA API GW 9.3 support for Json manipulation is very cumbersome.