Validae XML or Parse XML to JS/JSON very fast without C/C++ based libraries and no callback
You can use this library online (press try me button above), or as command from CLI, or in your website, or in npm repo.
$npm install fast-xml-parser
or using yarn
$yarn add fast-xml-parser
var fastXmlParser = ;var jsonObj = fastXmlParser;// when a tag has attributesvar options =attrPrefix : "@_"textNodeName : "#text"ignoreNonTextNodeAttr : trueignoreTextNodeAttr : trueignoreNameSpace : true;iffastXmlParser=== true//optionalvar jsonObj = fastXmlParser;//Intermediate objvar tObj = fastXmlParser;var jsonObj = fastXmlParser;
To use from command line
$xml2js [-ns|-a] <filename> [-o outputfile.json]
To use it on webpage
var isValid = parser;var jsonObj = parser;
Give me a star, if you really like this project.
I decided to created this library when I couldn't find any library which can convert XML data to json without any callback and which is not based on any C/C++ library.
Liraries that I compared
Why not C/C++ based libraries? Instalation of such libraries fails on some OS. You may require to install missing dependency manually.
Don't forget to check the performance report on comparejs.
validator benchmark: 2000 tps
This tool doesn't check if the XML is valid or not. If the XML is not valid you may get invalid result.
Report an issue or request for a feature here
Some of my other NPM pojects