What's the best JSON or JS object to XML converter module for Node JS [closed]
I investigated myself
| author | davidcalhoun | soldair | QuickenLoans | michaelkourlas ||---------------|--------------|-----------|--------------|----------------|| module | jstoxml | node- | node- | node- || | | jsontoxml | easyxml | js2xmlparser || Commits | 31 | 64 | 39 | 61 || Recent commit | a year ago | 2 years ag| 6 months ago | 16 days ago || Contributors | 2 | 7 | 7 | 6 || Issues | 16 | 19 | 17 | 15 || Open Issues | 7 | 1 | 6 | 1 || npm install | jstoxml | not found | easyxml | js2xmlparser || Dependencies | None | None | elementtree, | None || | | | inflect | || Throws errors | None | None | 3 | 12 |
Then there's the type of objects required to compare
{ "_name": 'foo', "_content": 'bar', "_attrs": { "a": 'b', "c": 'd' }}
soldair/node-jsontoxml:looks complicated
items: [{ "name": 'one', "_id": 1 }, { "name": 'two', "_id": 2 }]
michaelkourlas/node-js2xmlparser
foo: { "#": 'bar', "@": { a: 'b', c: 'd' }}
I think I'll give michaelkourlas's node-js2xmlparser a shot.
Update: It seems now that there are 2 more worth mentioning:
The latter is by far the most matured and downloaded on npm. It allows you to build XML in one go or iteratively.