CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-xml2json

Converts XML to JSON and vice-versa using node-expat parser

Overall
score

93%

Overview
Eval results
Files

rubric.jsonevals/scenario-5/

{
  "context": "Evaluates how well the solution uses xml2json's sanitization controls to serialize message payloads to XML and parse them back without double-encoding reserved characters. Checks proper use of toXml/toJson options, and whether text and attribute data flow through the library instead of custom escaping.",
  "type": "weighted_checklist",
  "checklist": [
    {
      "name": "toXml sanitize",
      "description": "Serializes via xml2json.toXml with sanitize: true so body text and meta attributes are escaped exactly once in the generated <message> element.",
      "max_score": 30
    },
    {
      "name": "toJson parsing",
      "description": "Parses XML with xml2json.toJson using object: true and explicit sanitize: false (or equivalent) to retrieve raw characters from escaped input instead of leaving entities or manually decoding.",
      "max_score": 25
    },
    {
      "name": "Text mapping",
      "description": "Maps the body into element text by supplying the xml2json text node key (e.g., $t) when calling toXml rather than building XML strings or treating body as an attribute.",
      "max_score": 20
    },
    {
      "name": "Attribute handling",
      "description": "Passes id, channel, and topic as attributes in the object sent to xml2json.toXml so the library escapes them, avoiding custom concatenation that can create &amp;amp; artifacts.",
      "max_score": 15
    },
    {
      "name": "Round-trip safety",
      "description": "Combines xml2json.toXml and xml2json.toJson without extra manual escaping so a toXml→toJson cycle preserves original characters (no double-encoded entities).",
      "max_score": 10
    }
  ]
}

Install with Tessl CLI

npx tessl i tessl/npm-xml2json

tile.json