BODtoJSON v2.1.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, streaming NDJSON, and declarative target schemas.
v2.1.0 establishes a zero-dependency core engine, introduces native single-pass ElementTree traversal, adds declarative schema projection (project() / to_records()) for Infor ION Scripting, and delivers a dual-pipeline streaming standard for Data Lakehouses and Vector Databases.
🚀 What’s New in v2.1.0 (vs. v1.0.0)
-
Zero-Dependency Core Engine: Removed
xmltodictin favor of a single-pass recursive traversal built purely on Python’s nativexml.etree.ElementTree. Eliminates external supply-chain risks, shrinks deployment footprints for air-gapped or Infor ION environments, and halves intermediate memory allocations. -
Infor ION Scripting Helpers (
to_records&project): Eliminates boilerplate XML namespace parsing,json.loads()line-splitting loops, and manual boolean coercion in ION scripts. CapturesApplicationAreaandDataArea/<Verb>header metadata automatically (include_header=True) and maps records directly into target REST/API JSON schemas. -
Explicit Dual-Pipeline Architecture: Dedicated top-level API methods—
to_jsonandto_ndjson—improve interface predictability and self-documentation. -
Strict NDJSON Linearization: Features compact serialization via
separators=(',', ':')and forced line termination (\n). Multi-noun batch payloads insideDataAreaare automatically unpacked and emitted as individual, single-line text records. -
100% Backward Compatibility: The original
convert()function remains active at the package root, routing toto_json()while emitting a non-breakingDeprecationWarningscheduled for removal in v3.0.0. -
Enterprise REST API Tier (
api.py): Added an optional, high-performance FastAPI microservice layer featuring zero-overhead streaming using rawResponseclasses and/projectschema mapping.
📈 Architectural Comparison
| Feature | Legacy (v1.0.0) | Enterprise Engine (v2.1.0) |
|---|---|---|
| Core Dependencies | Relied on xmltodict |
Zero External Dependencies (100% Python Stdlib) |
| Memory & Speed | Double-pass XML $\rightarrow$ Dict $\rightarrow$ Flat Dict | Single-pass ElementTree traversal (~50% lower memory) |
| Data Formats | Standard Structured JSON string | Standard JSON, Strict NDJSON, Native Dicts & Projected Schemas |
| Infor ION Scripting | Manual XML + JSON loop boilerplate | Declarative project() with automatic header context |
| Ingestion Target | Application memory / NoSQL DBs | Data Lakehouses (Snowflake/Databricks), Vector DBs & ION APIs |
| System Delivery | Library imports only | Library + Optional FastAPI Microservice Tier ([api]) |
🛠️ Installation
Core Library (Zero Dependencies)
Ideal for Infor ION Scripting, data-engineering pipelines, ETL workers, and air-gapped environments:
pip install BODtoJSON
With Enterprise REST API Tier
Includes fastapi and uvicorn for microservice deployment:
pip install "BODtoJSON[api]"
📂 Project Structure
BODtoJSON/
├── src/
│ └── BODtoJSON/
│ ├── __init__.py # Package version (2.1.0) & API exports
│ ├── mapper.py # Zero-Dependency Dual-Pipeline & Projection Engine
│ └── api.py # Optional FastAPI Microservice Ingestion Layer
├── tests/
│ ├── data/ # Raw OAGIS XML Test Datasets (.xml)
│ ├── config.py # Test Data Configuration
│ ├── conftest.py # Pytest Dataset Loader Fixtures
│ ├── test_mapper.py # Core Engine Unit Tests, ION Projection & Regression Suite
│ └── test_api.py # API Endpoint Verification
├── scripts/
│ └── inspect_payload.py # Multi-Profile Business Validation Utility
├── pyproject.toml # Build, Optional Extras & Pytest Configurations
└── README.md
🧪 Validation & Testing
1. Automated Testing (QA Suite)
Run the standardized pytest execution engine:
python -m pytest -v -p no:cacheprovider
2. Manual Payload Inspection (UAT Engine)
Verify transformation output profiles locally:
python scripts/inspect_payload.py
Toggle the mode parameter within inspect_payload.py between "ndjson", "json", "project", and "legacy" to inspect outputs in output_preview.json.
💻 Code Examples
1. Infor ION Scripting: Declarative Schema Projection (project)
Eliminates manual XML namespace handling, json.loads() loops, and boolean boilerplate.
import json
from BODtoJSON import project
SCHEMA = {
"externalSystemId": "company[{Sync_AccountingEntityID}];DIMENSION1;{ChartOfAccounts_BaseChartOfAccounts_GLNominalAccount}",
"isActive": "true",
"companyId": "company[3100]",
"dimensionName": "DIMENSION1",
"usableInPurchase": "true",
}
# Automatically merges DataArea/Sync header context with each flattened Noun record
items = project(input_var, verb="Sync", schema=SCHEMA, include_header=True)
output_var = json.dumps(items)
2. Native Python Records (to_records)
Extracts a Python list[dict] directly with optional ApplicationArea and Verb header context.
from BODtoJSON import to_records
records = to_records(xml_input, verb="Sync", include_header=True)
for rec in records:
print(rec["Sync_AccountingEntityID"], rec["PurchaseOrder_PurchaseOrderHeader_DisplayID"])
3. Modern Pipeline: Newline Delimited JSON (to_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 per record with zero internal spaces, terminated by \n
linearized_ndjson = to_ndjson(xml_input, verb="Sync")
4. Modern Pipeline: Standard Flattened JSON (to_json)
Optimized for application-level consumption and document-store indexing.
from BODtoJSON import to_json
xml_input = """<SyncPurchaseOrder>...</SyncPurchaseOrder>"""
# Returns a standard flat JSON string
flattened_json = to_json(xml_input, verb="Sync")
5. Legacy Pipeline: Backward-Compatible Conversion (convert)
Maintained for smooth migration of existing production pipelines.
from BODtoJSON import convert
xml_input = """<SyncPurchaseOrder>...</SyncPurchaseOrder>"""
# DEPRECATED: Scheduled for removal in v3.0.0.
# Internally routes to to_json() and emits a DeprecationWarning.
legacy_json = convert(xml_input, verb="Sync")
6. Running the Enterprise API Tier
Launch the microservice locally:
uvicorn BODtoJSON.api:app --reload
Open http://127.0.0.1:8000/docs to test /convert/ndjson, /convert/json, and /project directly via Swagger UI.
🤝 Commercial Value
By normalizing complex ERP structures into zero-dependency, flat JSON, streaming NDJSON, and projected API payloads, BODtoJSON v2.1.0 eliminates third-party library bloat and reduces AI, Lakehouse, and Infor ION integration overhead by up to 90%.
Author: Niraj Kakodkar
License: MIT
Metadata
Release files for BODtoJSON 2.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| bodtojson-2.1.2.tar.gz | 13.6 kB | Without provenance | Details for bodtojson-2.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| bodtojson-2.1.2-py3-none-any.whl | Python 3 | none | any | Details for bodtojson-2.1.2-py3-none-any.whl |
Total release size: 23.7 kB
Release files / bodtojson-2.1.2.tar.gz
| Download URL | bodtojson-2.1.2.tar.gz |
|---|---|
| Size | 13.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7b7993860d4763be4448fe9caa0e2512c7f325a4f48bf9ddbb2e4600f8fa9a22
|
|
BLAKE2b-256 checksum How to use checksums |
63b8bd4901be9d00e7801b50eb7ca8f76bf956a4375ba78c9fbfe976b3c4f50d
|
| 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.1.2-py3-none-any.whl
| Download URL | bodtojson-2.1.2-py3-none-any.whl |
|---|---|
| Size | 10.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
176ee60afec74dddfd1a8d47dc984d3de6980aa7fe22880086a3dfeaf813a9e0
|
|
BLAKE2b-256 checksum How to use checksums |
f2a1a23889bb81d1de9b275f0bbd30ae769375cdcd1e0d11a1e6b46cca36c81e
|
| 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.1.2
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.