I want to read a text file and write a text file in a clean JSON format.
My text file looks like this
Version:2
TaxiStation:6072
TaxiLicense:EM9543
System_ID:910
When I use the following:
data2= JSON.stringify(data2, null, position+1);
fs.writeFile(dirarray[0], data2, function(err) { ...
My output always comes out ugly : "Version:2\r\nTaxiStation:6072\r\nTaxiLicense:EM8378\r\n
Ideally, I would want to make my text file formatted nicely. Is it possible to achieve this?
{
"Version":2,
"TaxiStation":6072,
"TaxiLicense":"EM9543",
"System_ID":910
}