David
David

Reputation: 249

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?

Upvotes: 0

Views: 505

Answers (1)

Anders
Anders

Reputation: 3412

Either:

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

Or:

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

console.log(JSON.stringyfy(myObj);

Upvotes: 1

Related Questions