Skip to main content

Production-grade Infor OAGIS BOD to Flattened JSON converter.

Project description

BODtoJSON v1.5.0

BODtoJSON is an enterprise-grade Python library designed to transform complex Infor OAGIS (XML) Business Object Documents into modern, AI-ready flattened JSON structures.

BOD2JSon

v1.5.0 establishes a dual-pipeline standard, introducing strict single-line Newline Delimited JSON (NDJSON) generation alongside standard JSON, optimized directly for massive stream ingestions into Data Lakehouses and Vector Databases.


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

The transition to v1.5.0 introduces explicit processing pipelines and an enterprise API tier while safeguarding legacy system investments:

  • Explicit Format 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: The native engine now features compact serialization via separators=(',', ':') and forced line termination (\n). Repeating record blocks (arrays) are unpacked and emitted as individual, single-line text records.
  • 100% Backward Compatibility: The original convert() function remains functional at the package root. It automatically routes to to_json while issuing non-breaking DeprecationWarning logs to guide future code modernization.
  • Enterprise REST API Tier (api.py): Added a lightweight, high-performance FastAPI implementation featuring zero-overhead streaming using raw Response classes, eliminating middleware double-serialization bottlenecks.
  • Pytest Migration: The automated quality assurance framework has been upgraded to pytest, featuring regression test parameters that actively validate deprecation warning assertions.

📈 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

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

bodtojson-1.5.0.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

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

bodtojson-1.5.0-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file bodtojson-1.5.0.tar.gz.

File metadata

  • Download URL: bodtojson-1.5.0.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for bodtojson-1.5.0.tar.gz
Algorithm Hash digest
SHA256 0ad31f44bd6a3eea9cc1b5c8ae17c3214645f43484982fd625a03122c48bb4fe
MD5 a0063015df1a4725d7fd3e5c9460fce9
BLAKE2b-256 9595de7396e3b13ecf6f50a85b7a6a34e144a24438e55a7a9ef0ad62c07294fd

See more details on using hashes here.

File details

Details for the file bodtojson-1.5.0-py3-none-any.whl.

File metadata

  • Download URL: bodtojson-1.5.0-py3-none-any.whl
  • Upload date:
  • Size: 8.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for bodtojson-1.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 445c3edef2ebe6feed2e9c5aa9774472db6f27c13fadb5b27ea661000aa775ca
MD5 bf07a55f15bddc0939e8476c4fa518ee
BLAKE2b-256 cb9288258f06aa2fa9cce8a615c724d47eee8fa6e1ea1037408bfc4282ae568d

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