Skip to content

Properties from Object's prototype are including during XML creation #610

@aparshin

Description

@aparshin
  • Are you running the latest version?
  • Have you included sample input, output, error, and expected output?
  • Have you checked if you are using correct configuration?
  • Did you try online tool?

Description

If a custom property is added to Object's prototype, it is included in generated XML. It shouldn't happen because in some cases users can't control pollution of Object / Array prototypes.

Input

{a: 1}

Code

const { XMLBuilder } = require("fast-xml-parser"); // emulate pollution of Object's prototype Object.prototype.something = 'strange'; const builder = new XMLBuilder(); const xml = builder.build({ a: 1 }); console.log(xml);

Output

<a>1</a><something>strange</something> 

Expected output

<a>1</a> 

Would you like to work on this issue?

  • Yes
  • No

Bookmark this repository for further updates. Visit SoloThought to know about recent features.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions