I have a text that resembles the following structure:
{"age": "52", "id": 1, "name": "Hulk"}
{"age": "33", "id": 2, "name": "Iron Man"}
My goal is to parse the file and transform it into an array of objects.
This is the progress I have made so far:
const fs = require("fs");
const customerFile = fs.readFileSync("./customers.txt", "utf-8");
const customerArr = customerFile.split("\n");
Although I successfully split the file into an array, I am struggling with converting the array elements into objects. Can anyone provide guidance on how to achieve this?