JSON.stringify(
obj, // the object to stringify
replacer, // a function or array transforming the result
spaces // prettyprint indentation spaces
)
// It returns your array stringified (not print it)
// Example
console.log(JSON.stringify(yourArray, null, " "));
// print this
"{
"dvals": [
{
"brand": "1",
"count": "1"
},
{
"brand": "2",
"count": "2"
},
{
"brand": "3",
"count": "3"
}
]
}"