Convert files to JSON format
Project description
JSONIFYER
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.
Features
- 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
Table of Contents
Installation
Install via PyPI:
pip install jsonifyer
Or install locally for development:
git clone https://github.com/crpereir/jsonify.git
cd jsonifyer
pip install -e .
Quick Start
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"
)
Directory Structure
The package automatically manages input and output directories based on file types:
- CSV files:
csv_files/ - XML files:
xml_files/ - TXT files:
text_files/
Project Structure
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
Contributing
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
License
This project is licensed under the MIT License - see the LICENSE file for details.
Contact
- GitHub: https://github.com/crpereir/jsonifyer
- Email: carolinadpereira18[@]gmail.com & matilde.pato[@]isel.pt
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file jsonifyer-0.1.10.tar.gz.
File metadata
- Download URL: jsonifyer-0.1.10.tar.gz
- Upload date:
- Size: 18.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1aa1d27ef2079772afd97090040098e91182adc80479326101587c74ac210d48
|
|
| MD5 |
814762c653e8d9705e0715706b1fc395
|
|
| BLAKE2b-256 |
f43d39e2016aa8a15956b9b9f1a3bab2826412f18ac43f4cd5126f5d9b4a84ca
|
File details
Details for the file jsonifyer-0.1.10-py3-none-any.whl.
File metadata
- Download URL: jsonifyer-0.1.10-py3-none-any.whl
- Upload date:
- Size: 15.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4b986a61f6c11cc04eb4773caaf0287f1e4cf2d9568784185e460ef884c2a260
|
|
| MD5 |
fa65b5f452f0788b7f37517404bffdec
|
|
| BLAKE2b-256 |
0d6f3cbf9bca674c6d33366c345af36f691b2c4ab5dab69bb3e4c899e4a2cffe
|