Skip to main content

Convert files to JSON format

Project description

ISEL logo

JSONIFYER

PyPI version License: MIT Python Version Status

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

  1. Installation
  2. Quick Start
  3. Project Structure
  4. Contributing
  5. License
  6. Contact

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.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contact

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jsonifyer-0.1.3.tar.gz (18.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jsonifyer-0.1.3-py3-none-any.whl (14.9 kB view details)

Uploaded Python 3

File details

Details for the file jsonifyer-0.1.3.tar.gz.

File metadata

  • Download URL: jsonifyer-0.1.3.tar.gz
  • Upload date:
  • Size: 18.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for jsonifyer-0.1.3.tar.gz
Algorithm Hash digest
SHA256 d9ec850ce1cc532076f66e38aff4a0ed2b9e6ef663b1533bc7f561a27c08ebae
MD5 9afe249ff298b87040fa329ed0c1bfb0
BLAKE2b-256 e7b9f8f2ffae648e45429143d5a357483e11c370ca3ca7dba75cf19f49a158d8

See more details on using hashes here.

File details

Details for the file jsonifyer-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: jsonifyer-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 14.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for jsonifyer-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 6fb68975c19ff17cfb339addb07a0cd07ac73219edf621bf845c5c2c0988e4fe
MD5 0e288d530dc3d0f108c789bc5932a0b3
BLAKE2b-256 78c9b6bb5a8ded5ecb0305aec3e00541dc00e6d5c2357c6f8a5a606686752064

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page