how to make the following array, this gatewayB2c is dynamic, such as this:
"gatewayB2c": [{
"singlemaxamt": "9999999999999",
"biztype": "1201",
"singleminamt": "0.01",
"bankcode": "000000",
"bankname": "",
"cdflag": "A"
}]
is converted to the following format?
[{name: "singlemaxamt", value: "9999999999999"},
{name: "biztype", value: "1201"},
{name: "singleminamt", value: "0.01"},
{name: "bankcode", value: "000000"},
{name: "bankname", value: ""},
{name: "cdflag", value: "A"}]
has taken out the value of gateWayB2c. This is how it is written
.var ccc=gatewayB2c;
ccc.forEach(function(v,i){
var bbb = Object.keys(v);
Object.keys(v).forEach(function(v){
/*console.log(v)//key
console.log(ccc[i][v])//*/
var name = v;
var value = ccc[i][v];
var c=bbb.length;
//arr.push("name:"+v,"value:"+ccc[i][v]);
console.log(name+"------"+value);
})
console.log(arr);
})
The value is like this
singlemaxamt------9999999999999
biztype------1201
singleminamt------0.01
bankcode------000000
bankname------
cdflag------A
I don"t know how to write below