{"name":"simple-xml-to-json","version":"1.0.1","description":"A simple lightweight library converting XML schema to JSON","main":"src/xmlToJson.js","scripts":{"test":"npx jest"},"repository":{"type":"git","url":"git+https://github.com/nirgit/xml-to-json.git"},"keywords":["ast","xml","json","lightweight","simple"],"author":{"name":"Nir Moav","email":"getnirm@gmail.com"},"license":"MIT","devDependencies":{"chalk":"^3.0.0","jest":"^24.9.0"},"gitHead":"8f329066d76711db71fe13c0cc9acf8cafa41897","bugs":{"url":"https://github.com/nirgit/xml-to-json/issues"},"homepage":"https://github.com/nirgit/xml-to-json#readme","_id":"simple-xml-to-json@1.0.1","_nodeVersion":"11.15.0","_npmVersion":"6.7.0","dist":{"integrity":"sha512-OQ8ma+JBDDSz3iQ6+/M2l7/0oiehW2kAAnWogcTRx6sKNOvPxyrfAHn56ISrpUFpJ70oWMStcGd5FZBg6amKbw==","shasum":"54e4b95ff3a31197cc48b5af9b22830e34cf15bc","tarball":"http://registry-npm.ywwl.com/simple-xml-to-json/download/simple-xml-to-json-1.0.1.tgz","fileCount":14,"unpackedSize":29748,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd+HpUCRA9TVsSAnZWagAAzQ4P/1WHdAMjUkWEgAO+o+46\nIrT4b5B4/8g2Uh5rIC6K2ZnICRKnGEMslqS8NYdhAvGq3mT5t+Tt+sC8qDxO\nYToFRNcgq7k0Gp0PE70PHmMAbOm4I2caFzZW9ZBBoD2NG8Qht4tpr3lN2EDp\n5QAxEFFatcBgn+ykRMCm80Lxv7mH323j2rjn/x1iE6rIjWkwFdhlRyNjNTZb\nM65Ac6z9W1XrP9xvKXwEphr5O6NBxyWhgiTRT0VUdiG9dao5b2o7YcqDRaoL\n3dQ8jrHFD8KQkD+70m+g/CWx5Nf2iCACm1wbPvHUU28hULtJOTYQwhynm2CY\nZBdiJ1LDpN7E1TxILyS671Whn2TWSPyaCCaW8+pLrIWdt8darqlyd/GBS+ql\n4oiKVmqFiZNRpV2RNSZbhw2IJztVlXkCYqrH/HemL24TujnskTax9FkjQCuw\n80oyHdd/zyyki2cgc4KNDlVJoRm/WKaOf/IYENyTId7zsNyIP4MJ4qACZhCi\nFVEAaS3JLFsyK7ji3eUxIgFHKHtFN1+jpUfC6wcPHRVl2HyPaTGokNRucqd2\nyZty2tplOlWtYnLiGXZ6LO/qHCUxM4yBqaY+1KkiIrdhoC9uXYlt9f8QgQ4x\nM1Wh1r9kstsnL6lk/zGIygyHgtqt02WRgQGIUFliP0lunOoaGWczf4stRrR7\nBw1O\r\n=PkOf\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGxf8sYsnov6Y0JG178y28i3Ud7MsBkaSMrwH0czieHFAiBD5PUGWak6Dp+RlFOsU60jlsAqlH8cT4Wxq5j1tnMUjA=="}],"size":6286,"noattachment":false,"key":"/simple-xml-to-json/-/simple-xml-to-json-1.0.1.tgz"},"maintainers":[{"name":"nirmoav","email":"getnirm@gmail.com"}],"_npmUser":{"name":"nirmoav","email":"getnirm@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/simple-xml-to-json_1.0.1_1576565332425_0.6965511901487083"},"_hasShrinkwrap":false,"readme":"# A simple XML to JSON converter\n\n[![npm version](https://img.shields.io/npm/v/simple-xml-to-json.svg?style=flat-square)](https://www.npmjs.com/package/simple-xml-to-json)\n[![Test CI](https://github.com/nirgit/simple-xml-to-json/actions/workflows/node.js.yml/badge.svg)](https://github.com/nirgit/simple-xml-to-json/actions/workflows/node.js.yml)\n[![codecov](https://codecov.io/gh/nirgit/simple-xml-to-json/branch/master/graph/badge.svg?token=XW7CWWM4RV)](https://codecov.io/gh/nirgit/simple-xml-to-json)\n\n## Install\nSimply install using NPM in your project directory\n> npm install simple-xml-to-json\n\n\n## Usage and API\n### 1. convertXML(xmlToConvert [,customConverter])\n   * `xmlToConvert` \\<string\\>\n   * `customConverter` \\<function\\>\n   * Returns: \\<JSON\\> by default or other if `customConverter` is used\n   \n### 2. createAST(xmlToConvert)\n   * `xmlToConvert` \\<string\\>\n   * Returns: An AST representation of the XML \\<JSON\\>\n\nCode Example:\n```javascript\nconst {convertXML, createAST} = require(\"simple-xml-to-json\")\n\nconst myJson = convertXML(myXMLString)\nconst myYaml = convertXML(myXMLString, yamlConverter)\nconst myAst = createAST(myXMLString)\n````\n\n---\n### ![TS](https://raw.githubusercontent.com/nirgit/assets/master/simple-xml-to-json/ts_icon_32.png) Typescript compatible\n---\n\n## Notes and how to use code\n1. The easiest thing to start is to run `node example/example.js` in your terminal and see what happens.\n2. There's the `xmlToJson.js` file for convenience. Just pass in the XML as a String.\n3. It's MIT licensed so you can do whatever :)\n4. Profit\n\n## How this works in a nutshell\n1. The library converts the XML to an AST\n2. There is a JSON converter that takes the AST and spits out a JSON\n3. You can write your own converters if you need XML-to-ANY-OTHER-FORMAT\n\n## Benchmark\n\n_Take these results with a grain of salt._\\\nAccording to a __simple__ benchmark test I performed in __April 2024__ with a random XML. _YMMV_.\n![Benchmark Chart](https://github.com/nirgit/assets/blob/master/simple-xml-to-json/simple-xml-to-json-benchmark-2.png?raw=true)\n\n* The chart results __may be__ outdated. [Run the test yourself](https://runkit.com/nirgit/6620cf27943a41000847221d)\n\n\n## Current Drawbacks\n1. All values are translated to strings in JSON\n2. There are currently reserved words in the JSON converter: \n    * \"content\" \n    * \"children\"\n\n    so you cannot by default have an attribute with that name and free text as the content of the element or have nested elements as children.\n    \n    *If you need to, you can write your own converter from the AST created by the parser, and pass it as a 2nd parameter after the xml string*\n","publish_time":1576565332530,"_cnpm_publish_time":1576565332530,"dist-tags":{"latest":"1.2.7"}}