Skip to content

Instantly share code, notes, and snippets.

@gambitier
Created February 9, 2023 12:49
Show Gist options
  • Select an option

  • Save gambitier/2c8dcc663e093a3a5e3aaac3223ccca6 to your computer and use it in GitHub Desktop.

Select an option

Save gambitier/2c8dcc663e093a3a5e3aaac3223ccca6 to your computer and use it in GitHub Desktop.
import * as convert from 'xml-js';
const xml = readFileSync(filePath, {
encoding: 'utf8'
});
const result1 = convert.xml2json(xml, { compact: true, spaces: 4 });
const data = JSON.parse(result1) as DataType;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment