I'm working on a Node.js project using JavaScript. My issue is that I have an array with some data, and i want to use this data in the array to create a JSON file.
This is what I have:
var cars = ["Saab", "Volvo", "BMW"];
This is what I want:
{
"cars": [
{
"mark" : "Saab"
},
{
"mark" : "Volvo"
},
{
"mark" : "BMW"
}
]
}
Java has a library called Jackson which helps with this. Does Node.js not have something similar?
Please if the question does not live up to the rules, let me know.