JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 7
  • Score
    100M100P100Q70179F
  • License ISC

Convert xml string to neatly formatted JSON object

Package Exports

  • xml-json-format

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (xml-json-format) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

xml-json-format

Installation

USAGE

Run npm install --save xml-json-format

const toJSON = require('xml-json-format')

const xml = 
'<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' +
'    <title>Happy</title>' +
'    <todo>Work</todo>' +
'    <todo>Play</todo>' +
'</note>';

const jsonResult = toJSON(xml);

console.log(jsonResult);

/* expected: {
    "_declaration": {
        "_attributes": {
            "version": "1.0",
            "encoding": "utf-8"
        }
    },
    "note": {
        "_attributes": {
            "importance": "high",
            "logged": "true"
        },
        "title": "Happy",
        "todo": [
            "Work",
            "Play"
        ]
    }
} */