I have a 1.7GB XML file and I want to convert it into a JSON file. When I use "xml2json" module to parse it, it returns
Error: There are errors in your xml file: out of memory
My code is:
const fs = require("fs");
const parser = require("xml2json");
const xmlObject = fs.readFileSync("./database1.xml")
const tempObject = JSON.parse(parser.toJson(xmlObject));
And this is the error:
throw new Error('There are errors in your xml file: ' + parser.getError());
^
Error: There are errors in your xml file: out of memory
I already add the parameter "--max-old-space-size=4096" when running the code but it doesn't work.
Is there any solution? Or could someone provide another way to convert a large XML into JSON file? Thanks.