JSFiddle - React, Tailwind, and code Playground
HTML
<div id="result">
</div>
JavaScript
const json = [
{
"nm":"BRANCHID",
"vl":"1"
},
{
"nm":"TELLERID",
"vl":"9903"
},
{
"nm":"mobile",
"vl":"9903234565"
}
];
let result = document.getElementById('result');
let newObj = {};
json.forEach(sort);
function sort(item, index){
newObj[ json[index].nm ] = json[index].vl;
}
result.innerHTML += JSON.stringify(newObj);