JSPM

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

Another json to xml translator.

Package Exports

  • another-json-xml
  • another-json-xml/index.js

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 (another-json-xml) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

another-json2xml

Translates JSON to XML. In case of array, it will create a new element for each item named as parent element without the last symbol e.g. 's'.

how to import

const { json2xml } = require('another-json-xml');

how to use

const json = {
  "name": "John",
  "age": 30,
  "cars": {
    "car1": "Ford",
    "car2": "BMW",
    "car3": "Fiat"
  }
}
const xml = json2xml(json, config);

config

const config = {
  root: 'root',
  indent: '  ',
  exceptions: ['_id'],
  minify: false,
  }
}
  • root - root element name, default is 'root'
  • indent - indent string, default is '\t'
  • exceptions - array of keys that should be ignored, default is []
  • minify - minify xml, default is false, in case it is true indent will be ignored