A Python package to easily convert different types of files into JSON format. JSONIFYER provides a simple and efficient way to transform various file formats (XML, CSV, TXT) into JSON, making it easier to work with structured data in your Python applications.
- Convert XML files to JSON using either Python-based or XSLT methods
- Convert CSV files to JSON with customizable options
- Convert TXT files to JSON with customizable options
- Detailed error handling and validation
Install via PyPI:
pip install jsonifyerOr install locally for development:
git clone https://github.com/crpereir/jsonify.git
cd jsonifyer
pip install -e .from jsonify import convert_file, convert_csv, convert_xml
# Convert any supported file type
result = convert_file(
file_path="data/input/example.xml",
fields=["name", "description", "price"],
file_type="xml"
)
# Convert CSV specifically
result = convert_csv(
file_path="data/input/example.csv",
fields=["id", "name", "value"],
delimiter=",",
skiprows=1
)
# Convert XML with specific options
result = convert_xml(
file_path="data/input/example.xml",
fields=["name", "description"],
converter="python", # or "xslt"
namespaces={"ns": "http://example.com/ns"},
root_tag="items"
)The package automatically manages input and output directories based on file types:
- CSV files:
csv_files/ - XML files:
xml_files/ - TXT files:
text_files/
jsonify/
├── README.md # Project documentation
├── setup.py # Setup script for installation
└── src/
└── jsonifyer/
├── __init__.py # Package initialization
├── api.py # Main API functions
├── config.py # Directory management
├── config_loader.py # Configuration handling
├── main.py # Core conversion logic
└── converter/ # Conversion implementations
├── __init__.py
├── csv_converter.py
├── python_converter.py
└── xslt_converter.py
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- GitHub: https://github.com/crpereir/jsonifyer
- Email: carolinadpereira18[@]gmail.com & matilde.pato[@]isel.pt
