Skip to content
This repository was archived by the owner on Jan 8, 2026. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

History
-------
0.2.1 (Unreleased)
~~~~~~~~~~~~~~~~~~
- Added ``pyproject.toml`` and uv install instructions while maintaining
Python 2.7 compatibility.
0.2.0 (21 Nov 2018)
~~~~~~~~~~~~~~~~~~~~~
- ``xmljson`` command line script converts from XML to JSON (@tribals)
Expand Down
6 changes: 5 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,14 @@ The `Parker`_ convention absorbs the root element by default.
Installation
------------

This is a pure-Python package built for Python 2.7+ and Python 3.0+. To set up::
This is a pure-Python package built for Python 2.7+ and Python 3.0+. To install
using pip or the ``uv`` package manager::

pip install xmljson

# or with uv
uv pip install xmljson


Simple CLI utility
------------------
Expand Down
33 changes: 33 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[build-system]
requires = ["setuptools<45", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "xmljson"
version = "0.2.1"
description = "Converts XML into JSON/Python dicts/arrays and vice-versa."
readme = "README.rst"
requires-python = ">=2.7"
authors = [{name = "S Anand", email = "root.node@gmail.com"}]
license = {file = "LICENSE"}
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Topic :: Software Development :: Libraries :: Python Modules",
]

[project.scripts]
xml2json = "xmljson.__main__:main"

[project.optional-dependencies]
test = ["lxml", "pytest"]

[tool.uv]
managed = true
5 changes: 3 additions & 2 deletions xmljson/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@

import sys
from collections import Counter, OrderedDict

try:
from lxml.etree import Element
except ImportError:
except ImportError: # pragma: no cover - fallback for environments without lxml
from xml.etree.cElementTree import Element

__author__ = 'S Anand'
__email__ = 'root.node@gmail.com'
__version__ = '0.2.0'
__version__ = '0.2.1'

# Python 3: define unicode() as str()
if sys.version_info[0] == 3:
Expand Down