2021年3月9日星期二

How to use xml-js without '_text' props of object

I using NPM module xml-js.

const convert = require('xml-js')  const xml = `___xml text___`  const result = convert.xml2json(xml)  console.log(result)  // This result like:  // {"foo":[  //  {"bar": {"_text": "__something_value__"}},  //  {"bar": {"_text": "__something_value__"}},  //  {"bar": {"_text": "__something_value__"}}  // ]}  

How to use without _text like:

// {"foo":[  //  {"bar": "__something_value__"},  //  {"bar": "__something_value__"},  //  {"bar": "__something_value__"}  // ]}    
https://stackoverflow.com/questions/66557364/how-to-use-xml-js-without-text-props-of-object March 10, 2021 at 10:03AM

没有评论:

发表评论