Leonidas-from-XIV / node-xml2js

XML to JavaScript object converter.
MIT License
4.87k stars 601 forks source link

XML to JSON conversion does not put double quotes #569

Open bpcsguru opened 4 years ago

bpcsguru commented 4 years ago

I am using xml2js to convert XML to JSON. When JSON have node of string data type but all numbers in it then JSON conversion will not put double quotes.

e.g. 1234 then JSON is created with {"productCode":1234} but I am really expecting values in format {"productCode":"1234"}.

I am using 0.4.15 version. Please let me know if it is known bug and if it was fixed !! Thanks in advance !!

bpcsguru commented 4 years ago

I am using xml2js to convert XML to JSON. When JSON have node of string data type but all numbers in it then JSON conversion will not put double quotes.

e.g. 1234 then JSON is created with {"productCode":1234} but I am really expecting values in format {"productCode":"1234"}.

I am using 0.4.15 version. Please let me know if it is known bug and if it was fixed !! Thanks in advance !!

bpcsguru commented 4 years ago

I am using xml2js to convert XML to JSON. When JSON have node of string data type but all numbers in it then JSON conversion will not put double quotes.

e.g.

1234 then JSON is created with {"productCode":1234} but I am really expecting values in format {"productCode":"1234"}. I am using 0.4.15 version. Please let me know if it is known bug and if it was fixed !! Thanks in advance !!
dhwaneetbhatt commented 4 years ago

@bpcsguru Trying using ignoreAttrs in the options object to see if it produces only strings.