Converts XML to JSON and vice-versa using node-expat parser
Overall
score
93%
{
"context": "Checks whether xml2json is used in reversible mode to keep text nodes explicit for round-tripping, including honoring custom text keys and rebuilding XML from the reversible structure. Focuses entirely on how the converter APIs are configured and applied to preserve content across both directions.",
"type": "weighted_checklist",
"checklist": [
{
"name": "Reversible conversion",
"description": "Calls xml2json.toJson with `reversible: true` so text content is stored under a text node key instead of being collapsed into plain values.",
"max_score": 30
},
{
"name": "Object output",
"description": "Sets `object: true` on toJson (or equivalent) to work with the reversible JSON object rather than the default serialized string.",
"max_score": 10
},
{
"name": "Default text key",
"description": "When no custom key is provided, preserves text under the package’s default `$t` property in the reversible JSON.",
"max_score": 15
},
{
"name": "Custom text key",
"description": "Maps the optional `textKey` argument to xml2json’s `alternateTextNode` option so the reversible JSON uses that property name while still round-tripping correctly.",
"max_score": 20
},
{
"name": "Round-trip output",
"description": "Feeds the reversible JSON into xml2json.toXml to regenerate XML that matches the input content, relying on the preserved text nodes for correctness.",
"max_score": 20
},
{
"name": "Attribute preservation",
"description": "Uses xml2json’s conversions (not manual string assembly) so element attributes survive the JSON conversion and appear in the round-tripped XML.",
"max_score": 5
}
]
}Install with Tessl CLI
npx tessl i tessl/npm-xml2jsondocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10