fast-xml-builder is a JavaScript/TypeScript library designed to efficiently construct XML documents from JSON objects without relying on C/C++ native addons, ensuring broad compatibility across different environments. It is currently at version 1.1.5 and is actively maintained, having been split from its parent project, `fast-xml-parser`, to provide a more focused and independent XML building solution. This separation allows for distinct development cycles and reduces potential issues for users solely interested in XML generation. The library differentiates itself by offering extensive configuration options, many of which are directly compatible with `fast-xml-parser`'s output structure, such as `preserveOrder`, `ignoreAttributes`, `attributeNamePrefix`, and `format`. This ensures seamless integration for workflows involving both parsing and building XML using the `fast-xml` ecosystem. Its release cadence is tied to its upstream `fast-xml-parser` counterpart, with updates released as needed to maintain compatibility and introduce new features.
npm install fast-xml-builderVerified import paths — ran on the pinned version, not inferred.
Demonstrates basic usage for converting JSON objects to XML, including simple elements, attributes, nested structures, and formatting options.
Install `fast-xml-builder` separately: `npm install fast-xml-builder`. Update your import statements to target this new package.
Always refer to the `fast-xml-builder` documentation or the `XMLExportOptions` type definition for a comprehensive list of available options and their expected behavior to ensure your desired XML output.
Pass an options object to the `XMLBuilder` constructor or `build` method: `{ format: true, indentBy: ' ' }` (or your preferred indentation string).No dependency data recorded yet.