Converts XML to JSON and vice-versa using node-expat parser
Overall
score
93%
Ignore null children when emitting XML
Uses toXml
100%
100%
Default null omission
66%
100%
Toggle for nulls
80%
100%
Data shaping
100%
100%
Return JS object instead of JSON string
Object mode
100%
100%
Attributes kept
100%
100%
Product array
100%
100%
Trimmed text
33%
100%
Buffer input
0%
100%
XML to JSON conversion (string output with JS-safe escaping)
toJson usage
100%
100%
JS-safe output
100%
100%
Object mode
100%
100%
Array notation
100%
100%
Sanitize toggle
100%
100%
Option passthrough
100%
100%
Array notation to collect repeated tags (global or selective)
API usage
100%
100%
Object output
100%
100%
Global arrays
100%
100%
Selective arrays
100%
100%
Order kept
100%
100%
Sanitization controls to escape/unescape without double-encoding
toXml sanitize
100%
0%
toJson parsing
100%
100%
Text mapping
100%
0%
Attribute handling
100%
0%
Round-trip safety
100%
40%
Reversible mode preserving text nodes for round-trip
Reversible conversion
100%
100%
Object output
100%
100%
Default text key
100%
100%
Custom text key
100%
100%
Round-trip output
100%
100%
Attribute preservation
100%
100%
CLI xml2json command for stdin to JSON with --version support
Uses xml2json CLI
100%
100%
Stdin piping
60%
100%
Pretty output
100%
100%
Error handling
73%
100%
Version passthrough
93%
100%
Alternate text node key name selection
Library parsing
100%
100%
Object output
100%
100%
Reversible mode
100%
100%
Custom string key
100%
100%
Short key toggle
100%
100%
Default `$t` fallback
100%
100%
JSON or string input to XML generation with attribute/$t mapping
toXml use
100%
100%
Attribute mapping
100%
100%
Sanitize option
100%
100%
Ignore null option
100%
100%
Whitespace trimming and text-node collapsing in non-reversible mode
toJson object output
100%
100%
Trim option
60%
100%
Reversible off
80%
100%
Collapsed text values
33%
100%
Whitespace-only nodes
80%
100%
Install with Tessl CLI
npx tessl i tessl/npm-xml2json