Javascript Object Convert to Json with custom space characters

Description

Javascript Object Convert to Json with custom space characters


let whitelist = [ "test", "test2" ];

let obj2 = {//from  w  w w  .j av a 2s.c  om
  "test" : "value1",
  "test2" : 3.44,
  "test3" : false
};
jsonobj = JSON.stringify(obj2, whitelist, "***");

console.log(jsonobj); // not test3



PreviousNext

Related