xml-js icon indicating copy to clipboard operation
xml-js copied to clipboard

NativeType Conversion Changing Value

Open macpatel opened this issue 6 years ago • 1 comments

Hi,

I am experiencing issue while converting XML to JSON. Where i found that "15932618675018011" (string) was getting converted to 15932618675018012 (number), changing its type and the value as well. Below are the options i had set.

  let xml2jsOptions = {
    ignoreComment: true,
    alwaysChildren: true,
    compact: true,
    trim: true,
    nativeType: true,
    nativeTypeAttributes: true,
    attributesKey: 'attributes',
    textKey: 'value',
    ignoreDeclaration: true,
    ignoreComment: true,
    ignoreCdata: true,
    ignoreDoctype: true,
  };

TO fix the above issue i changed nativeType: true, => nativeType: false, and it stopped converting values.

Can we have the fix in the library so that it stops behaving this way ?

macpatel avatar Apr 25 '19 15:04 macpatel

@lohiaad Please take a note of this issue

macpatel avatar Apr 25 '19 15:04 macpatel