Skip to content

peterroe/xtj

Repository files navigation

XTJ

A tiny unit to convert xml to javascript object.

Features

  • Typescript support.
  • ESM and UMD friendly.
  • Tiny size.

Install

$ npm install xtj

Usage

import XmlToJs from 'xtj'

const str = `<MyRoot><test>Success</test><test2><item>val1</item><item>val2</item></test2></MyRoot>`

XmlToJs(str)

/* =>
{
  "HTML": [
    {
      "HEAD": "",
    },
    {
      "BODY": [
        {
          "MYROOT": [
            {
              "TEST": "Success",
            },
            {
              "TEST2": [
                {
                  "ITEM": "val1",
                },
                {
                  "ITEM": "val2",
                },
              ],
            },
          ],
        },
      ],
    },
  ],
}
*/

About

Convert xml to javascript object

Topics

Resources

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published