Imagine having an object structured as follows:
var test = {
jsonString: {
groups: ['1','2','3','4','5']
}
}
How could you transform it into a JSON string like this?
var test = {
jsonString: "{\"groups\":[\"1\",\"2\",\"3\",\"4\",\"5\"]}"
}
I find myself a bit confused on how to achieve this. I'm not entirely convinced that JSON.stringify(test.jsonString)
would provide the exact output I desire. Any guidance or assistance in the right direction would be greatly appreciated! Thank you!