Converts XML to JSON and vice-versa using node-expat parser
Overall
score
93%
{
"context": "Evaluates whether the solution leverages xml2json to produce reversible JSON with caller-controlled text node keys. Checks correct optioning for custom string keys, the `_t` shortcut, and the default `$t` behavior while preserving attributes in object output.",
"type": "weighted_checklist",
"checklist": [
{
"name": "Library parsing",
"description": "Uses xml2json's parsing API (not a custom XML parser) to perform the XML-to-JSON conversion.",
"max_score": 15
},
{
"name": "Object output",
"description": "Invokes xml2json with `object: true` so the converter returns a JavaScript object rather than a JSON string.",
"max_score": 15
},
{
"name": "Reversible mode",
"description": "Sets `reversible: true` when converting so text nodes are emitted under a dedicated key instead of collapsing element content.",
"max_score": 15
},
{
"name": "Custom string key",
"description": "When `textKey` is a string, passes that value to xml2json via `alternateTextNode` to place text content under the requested property name.",
"max_score": 20
},
{
"name": "Short key toggle",
"description": "When `textKey` is true, sets `alternateTextNode: true` so xml2json emits `_t` for text content as expected.",
"max_score": 15
},
{
"name": "Default `$t` fallback",
"description": "When no text key is provided, relies on xml2json defaults (no `alternateTextNode` override) so text nodes appear under `$t` while attributes remain intact.",
"max_score": 20
}
]
}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