Open wilywork opened 8 years ago
With this code:
var parser = require('./index');
// xml to json
var xml = "test";
console.log("input -> %s", xml)
var json = parser.toJson(xml);
console.log("to json -> %s", json);
var xml = parser.toXml(json);
console.log("back to xml -> %s", xml)
I get
input -> test
to json -> {}
back to xml ->
Which seems to be correct to me. Why should it be "null"?
var valid = parser.toJson("<xml><test></test></xml>");
if(valid.xml.test){ //return true, valid.xml.test = { }
console.log(valid.xml.test) // output [object Object]
}
...
error in json result, instead of null appears an object.
xmlExample = "test ";
xmlExample.toJson(xmlExample);
// result
{ "xml":{ "text":"teste", "text2":{} <== Bug, should be null } }