gatewayibm-datapower

IBM Datapower gatewayscript


I am trying to build a json that has 2 nodes, for example: "name":"david", and "id":"123123". So I am trying to do it with a new object with 2 nodes and then "stringify(obj)". I tried it in several ways but nothing is working for me. Any ideas?


Solution

  • Either:

    const myObj = {
                   name: "David", 
                   id: "1"
               };
    

    Or:

    const myObj = {};
    myObj.name = "David";
    myObj.id = "1";
    

    console.log(JSON.stringyfy(myObj);