{ "info": { "author": "Bhavyadeep Purswani", "author_email": "bhavyadeep.purswani98@gmail.com", "bugtrack_url": null, "classifiers": [ "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# JsonToXML\n\nA module to convert JSON to XML format.\n\n# Details\n\nThe module contains functions to convert a JSON File/String to an XML File/String. In case the XML is to be processed further, the pointer root node containing the XML data can also be returned using the specific function.\n\nThe module has following functions:\n\nFunction | Description\n-------- | -----------\nfromFile( filename [, rootName ]) | Takes JSON data from the specified filename and returns the root pointer.\nfromText( text [, rootName ]) | Takes JSON data in form of a string and returns the root pointer.\nfromFiletoFile( inputFile, outputFile [, rootName ]) | Takes JSON data from the specified inputFile and writes the XML data to the specified outputFile.\nfromTexttoFile( text, outputFile [, rootName ]) | Takes JSON data in form of a string and writes the XML data to the specified outputFile.\nfromFiletoText( inputFile [, rootName ]) | Takes JSON data from the specified inputFile and returns the XML data in form of a string.\nfromTexttoText( text [, rootName ]) | Takes JSON data in form of a string and returns the XML data as a string.\n\n**Note:** The root node of the XML data is by default \"root\", but can be specified by passing the argument \n`rootName = \"Custom Name\"` to the function.\n\n**This Module works well with Python 3**\n\n# Installation\n\nThe module can be installed using the pip command:\n\n pip install JsonToXML\n\n# Usage\n\nThe usage of Module is pretty simple, you have to just import the library and use the functions directly.\n\n### fromFile( file [, rootName ] )\n\n\timport JsonToXML\n\timport xml.etree.cElementTree as ET\n\timport xml.dom.minidom\n\troot = JsonToXML.fromFile(\"example.json\", rootName=\"Employees\") # convert the file to XML and return the root node\n\txmlData = ET.tostring(root, encoding='utf8',method='xml').decode() # convert the XML data to string\n\tdom = xml.dom.minidom.parseString(xmlData) \n\tprettyXmlData = dom.toprettyxml() # properly format the string of XML data\n\tprint(prettyXmlData) # print the formatted XML data\n\nThe above program reads JSON data from a file and *pretty prints* (With proper Indentation and line breaks) XML data on the screen.\n\n### fromText( text [, rootName ] )\n\n\timport JsonToXML\n\timport xml.etree.cElementTree as ET\n\timport xml.dom.minidom\n\texampleJSON = \"{ 'employee': { 'name':'sonoo', 'salary':56000, 'married':true } }\"\n\troot = JsonToXML.fromText(exampleJSON) # convert the string to XML and return the root node\n\txmlData = ET.tostring(root, encoding='utf8',method='xml').decode() # convert the XML data to string\n\tdom = xml.dom.minidom.parseString(xmlData) \n\tprettyXmlData = dom.toprettyxml() # properly format the string of XML data\n\tprint(prettyXmlData) # print the formatted XML data\n\nThe above program reads JSON from a string and prints the XML data on the screen.\n\n### fromFiletoFile( inputFile, outputFile [, rootName ] )\n\n\timport JsonToXML\n\tJsonToXML.fromFiletoFile(\"example1.json\",\"example2.xml\") # converts the JSON data from the file to XML and writes it on the XML file.\n\nThe above program simply converts the JSON data from the inputFile and writes XML data to the outputFile.\n\n### fromTexttoFile( text, outputFile [, rootname ] )\n\n\timport JsonToXML\n\texampleJSON = \"{ 'employee': { 'name':'sonoo', 'salary':56000, 'married':true } }\"\n\tJsonToXML.fromFiletoFile(exampleJSON,\"example2.xml\") # converts the JSON data from the string to XML and writes it on the XML file.\n\nThe above program simply converts the JSON data from the string and writes XML data to the outputFile.\n\n### fromFiletoText( inputFile [, rootName ] )\n\n\timport JsonToXML\n\txmlData = JsonToXML.fromFiletoText(\"example1.json\") # converts the JSON data from the file to XML and returns string of XML data.\n\tprint(xmlData)\n\nThe above program reads JSON data from a file and returns a formatted string of XML data.\n\n### fromTexttoText( inputFile [, rootName ] )\n\n\timport JsonToXML\n\texampleJSON = \"{ 'employee': { 'name':'sonoo', 'salary':56000, 'married':true } }\"\n\txmlData = JsonToXML.fromTexttoText(exampleJSON) # converts the JSON data from the string to XML and returns string of XML data.\n\tprint(xmlData)\n\nThe above program reads JSON data from a string and returns a formatted string of XML data.\n\n# Author\n\n* Author: Bhavyadeep Purswani\n* E-Mail: bhavyadeep.purswani98@gmail.com\n* Repository: https://github.com/bhavyadeep-purswani/JsonTOXML\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/bhavyadeep-purswani/JsonTOXML", "keywords": "", "license": "LICENCE.txt", "maintainer": "", "maintainer_email": "", "name": "JsonToXML", "package_url": "https://pypi.org/project/JsonToXML/", "platform": "", "project_url": "https://pypi.org/project/JsonToXML/", "project_urls": { "Homepage": "https://github.com/bhavyadeep-purswani/JsonTOXML" }, "release_url": "https://pypi.org/project/JsonToXML/0.0.2/", "requires_dist": null, "requires_python": "", "summary": "A Library to convert JSON into XML format.", "version": "0.0.2" }, "last_serial": 5506270, "releases": { "0.0.2": [ { "comment_text": "", "digests": { "md5": "6d0aa52c4482d93dac0c5f6798c262c3", "sha256": "4ed0e5aedb81aeabc96f5c6d2b00c0fdaa54dcd15e5f37169b62f93f5748331f" }, "downloads": -1, "filename": "JsonToXML-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "6d0aa52c4482d93dac0c5f6798c262c3", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 3777, "upload_time": "2019-07-09T10:54:11", "url": "https://files.pythonhosted.org/packages/bc/c4/279cc34fb9c1d9b05c913328b7c8ddb87e62fb697780e96c388c060cbf66/JsonToXML-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1ee6d44512843c5c3ffd533265a88d7b", "sha256": "b0b44bb5341c1fbe03fbdb37c60571e736d452fcab8fcb2f8b667a51ca3744dc" }, "downloads": -1, "filename": "JsonToXML-0.0.2.tar.gz", "has_sig": false, "md5_digest": "1ee6d44512843c5c3ffd533265a88d7b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2789, "upload_time": "2019-07-09T10:54:13", "url": "https://files.pythonhosted.org/packages/68/92/58b48803c151ad95320bdda9ca22a2ce63e93a553277f30fd8476cd56435/JsonToXML-0.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "6d0aa52c4482d93dac0c5f6798c262c3", "sha256": "4ed0e5aedb81aeabc96f5c6d2b00c0fdaa54dcd15e5f37169b62f93f5748331f" }, "downloads": -1, "filename": "JsonToXML-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "6d0aa52c4482d93dac0c5f6798c262c3", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 3777, "upload_time": "2019-07-09T10:54:11", "url": "https://files.pythonhosted.org/packages/bc/c4/279cc34fb9c1d9b05c913328b7c8ddb87e62fb697780e96c388c060cbf66/JsonToXML-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1ee6d44512843c5c3ffd533265a88d7b", "sha256": "b0b44bb5341c1fbe03fbdb37c60571e736d452fcab8fcb2f8b667a51ca3744dc" }, "downloads": -1, "filename": "JsonToXML-0.0.2.tar.gz", "has_sig": false, "md5_digest": "1ee6d44512843c5c3ffd533265a88d7b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2789, "upload_time": "2019-07-09T10:54:13", "url": "https://files.pythonhosted.org/packages/68/92/58b48803c151ad95320bdda9ca22a2ce63e93a553277f30fd8476cd56435/JsonToXML-0.0.2.tar.gz" } ] }