Skip to main content

BODtoJSON v2.0.0

BODtoJSON is a zero-dependency, enterprise-grade Python data liquidity engine designed to transform complex Infor OAGIS (XML) Business Object Documents into modern, AI-ready flattened JSON and NDJSON structures.

BOD2JSon

v2.0.0 marks a major architectural milestone: eliminating all external core dependencies, introducing native single-pass ElementTree traversal, and establishing a dual-pipeline streaming standard for Data Lakehouses and Vector Databases.


🚀 What’s New in v2.0.0 (vs. v1.0.0)

  • Zero-Dependency Core Engine: Removed xmltodict in favor of a single-pass recursive traversal built purely on Python’s native xml.etree.ElementTree. This eliminates external supply-chain risks, shrinks deployment footprints for air-gapped or serverless environments, and halves intermediate memory allocations.
  • Explicit Dual-Pipeline Architecture: Replaced parameter-driven routing with dedicated top-level API methods—to_json and to_ndjson—improving interface predictability and self-documentation.
  • Strict NDJSON Linearization: Features compact serialization via separators=(',', ':') and forced line termination (\n). Multi-noun batch payloads inside DataArea are automatically unpacked and emitted as individual, single-line text records.
  • Enterprise REST API Tier (api.py): Added an optional, high-performance FastAPI microservice layer featuring zero-overhead streaming using raw Response classes, eliminating middleware double-serialization bottlenecks.
  • Pytest Suite: Standardized automated quality assurance on pytest, including regression assertions for deprecation warnings.

📈 Why it is Better & Improved

Feature Production (v1.0.0) Streaming Engine (v1.5.0)
Data Formats Standard Structured JSON string Dual-Engine: Standard JSON & Strict Single-Line NDJSON
API Interface Single convert() entry point Explicit to_json() and to_ndjson() methods
Ingestion Target Application memory / NoSQL DBs Data Lakehouses (Snowflake/Databricks) & Vector DBs (RAG)
System Delivery Library imports only Library + High-Performance FastAPI Ingestion Tier
Regression Safety Basic structural testing Deprecation warning validation via Pytest

🛠️ Installation

pip install BODtoJSON

📂 Project Structure

BODtoJSON/
├── src/
│   └── BODtoJSON/
│       ├── __init__.py      # Universal API exposure & versioning
│       ├── mapper.py        # Dual-Pipeline Transformation Engine
│       └── api.py           # FastAPI Microservice Ingestion Layer
├── tests/
│   ├── data/                # Raw OAGIS XML Test Datasets (.xml)
│   ├── config.py            # Global Test Environments Data Configuration
│   ├── conftest.py          # Pytest Dataset Loader Fixtures
│   ├── test_mapper.py       # Core Engine Unit Tests & Deprecation Validation
│   └── test_api.py          # API Performance Endpoint Verification
├── scripts/
│   └── inspect_payload.py   # Multi-Profile Business Validation Utility
├── pyproject.toml           # Modern Build and Pytest Configurations
└── README.md

🧪 Validation & Testing

1. Automated Testing (QA)

To run the standardized test suite and verify engine logic:

python -m pytest -v -p no:cacheprovider

2. Manual Payload Inspection (UAT)

To verify the commercial value of the output and inspect the flattened JSON:

python scripts/inspect_payload.py

This script generates an output_preview.json in the root directory for side-by-side audit with the original XML. Note: Toggle the mode parameter within inspect_payload.py between "ndjson", "json", and "legacy" to evaluate various system outputs directly in output_preview.json.


💻 Code Example

  1. Modern Pipeline: Newline Delimited JSON (NDJSON) Optimized for Data Lakehouses (Snowflake/Databricks) and Vector Database ingestion.
from BODtoJSON import to_ndjson

xml_input = """<SyncPurchaseOrder>...</SyncPurchaseOrder>"""

# Returns a dense, single-line string with zero internal spaces, terminated by a clean \n
linearized_ndjson = to_ndjson(xml_input, verb="Sync")
  1. Modern Pipeline: Standard Flattened JSON Optimized for application-level consumption and quick document-store indexing.
from BODtoJSON import to_json

xml_input = """<SyncPurchaseOrder>...</SyncPurchaseOrder>"""

# Returns standard, single flat JSON string
flattened_json = to_json(xml_input, verb="Sync")
  1. Legacy Pipeline: Backward-Compatible Conversion Maintained to ensure active production systems do not break during upgrades.
from BODtoJSON import convert

xml_input = """<SyncPurchaseOrder>...</SyncPurchaseOrder>"""

# WARNING: This method is deprecated and will be removed in v2.0.0.
# It internally routes to to_json() but fires a DeprecationWarning log.
legacy_json = convert(xml_input, verb="Sync")
  1. Running the Enterprise API Tier Launch your processing microservice engine locally:
uvicorn BODtoJSON.api:app --reload

Navigate your browser to http://127.0.0.1:8000/docs to interact with the visual Swagger UI. Use /convert/json or /convert/ndjson to execute on-demand pipeline testing.


🤝 Commercial Value

By providing native, low-latency transformations for both document-level applications and streaming data pipelines, BODtoJSON v1.5.0 reduces cloud compute and token serialization costs by up to 90%. It acts as an optimized, zero-friction interface between legacy ERP architectures (Infor LN/M3) and modern enterprise data lakes or generative AI strategies. Author: Niraj Kakodkar
License: MIT

Metadata

Release files for BODtoJSON 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for BODtoJSON 2.0.0
File Size Uploaded Provenance Actions
bodtojson-2.0.0.tar.gz 11.7 kB Without provenance Details for bodtojson-2.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for BODtoJSON 2.0.0
File Interpreter ABI Platform Actions
bodtojson-2.0.0-py3-none-any.whl Python 3 none any Details for bodtojson-2.0.0-py3-none-any.whl

Total release size: 20.4 kB

Release files / bodtojson-2.0.0.tar.gz

Download URL bodtojson-2.0.0.tar.gz
Size 11.7 kB
Tags Source
SHA-256 checksum
How to use checksums
df653152bff14520fe6563a126f8dae85c13e9844faa0c35223607396eb47753
BLAKE2b-256 checksum
How to use checksums
74f2fe74a2fd98b6819bc7d5d8b57d49c122fa7d697ee5396ba0adab678d799e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.9

Release files / bodtojson-2.0.0-py3-none-any.whl

Download URL bodtojson-2.0.0-py3-none-any.whl
Size 8.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a8195542711e8cffa9ce7de0545fbb2bbec8d1455a2b4a5892fb735f8137d21e
BLAKE2b-256 checksum
How to use checksums
15f3dc0e5d22f12f12a2be85b16d1c5e9d0adfbb26a2ecc92b8d5c6a726d89ef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.9

Security for BODtoJSON 2.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page