onnx2json
Exports the ONNX file to a JSON file or JSON dict.
What it is and what it does
onnx2json is a command-line and Python library tool that serializes ONNX (Open Neural Network Exchange) model files into JSON format. It reads a binary ONNX file and outputs either a JSON file or an in-memory dictionary representation of the model's structure, graph, and metadata. The tool supports customizable JSON indentation and can work with pre-loaded ONNX graph objects.
The package is designed for developers who need to inspect, analyze, or transform ONNX models in a human-readable or programmatically accessible format. It has no runtime dependencies beyond Python itself, making it lightweight to install. However, it is no longer actively maintained—the last release was in January 2023, and the repository shows no recent commits, meaning it will not receive updates for new ONNX features or Python versions.
Use it for:
- Inspect the structure and metadata of an ONNX neural network model for debugging or documentation.
- Convert ONNX models to JSON for integration with web-based model viewers or analysis tools.
- Programmatically extract and manipulate ONNX model information in Python scripts.
- Serialize ONNX graphs to JSON as an intermediate step in model transformation pipelines.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Converts ONNX model files to JSON format, either writing to a file or returning a dictionary representation of the model structure.
Yes, if you need to convert ONNX models to JSON and are working with models from before early 2023. The package is stable, has no dependencies, and carries no known vulnerabilities. However, do not rely on it for long-term maintenance or support for cutting-edge ONNX features—it is abandoned. If you need active development or compatibility with the latest ONNX specifications, consider alternatives or maintain a fork.
Install
onnx2json on PyPI
pip
pip install onnx2jsonuv
uv add onnx2jsonpoetry
poetry add onnx2jsonInstalling onnx2json
Before you install
Installs with no runtime dependencies and low friction. However, the package is abandoned—last release was 2023-01-25 and no commits since then. It will not receive updates or security patches.
License in practice
MIT License permits commercial and private use with minimal restrictions, requiring only attribution and inclusion of the license text.
Quickstart
pip install onnx2json
from onnx2json import convert
onnx_json = convert(
input_onnx_file_path="model.onnx",
output_json_path="model.json",
json_indent=2
)
Requires Python 3.6 or later. The ONNX model file must exist at the specified path.
Verify before relying
- Whether the package handles all ONNX opset versions correctly or only specific versions.
- Performance characteristics when converting large or complex ONNX models.
- Compatibility with recent ONNX library versions released after 2023.
Package facts
| License | MIT License (permissive) |
| Python support | supports the current Python release (>=3.6) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | abandoned — 1,297 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 82,977/month — #14,111 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: onnx2json-2.0.4-py3-none-any.whl
Tags
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to…
permissive · top 100 on PyPI
huggingface-hubClient library and CLI tool for downloading,…
permissive · top 100 on PyPI
langchainLangChain provides a framework for building…
permissive · top 1,000 on PyPI
hf-xethf-xet provides chunk-based deduplication and…
permissive · top 1,000 on PyPI
tokenizersTokenizers converts raw text into token…
permissive · top 1,000 on PyPI
transformersTransformers provides a unified framework for…
permissive · top 1,000 on PyPI
json2onnxConverts JSON files to ONNX model format,…
permissive · top 15,000 on PyPI
sed4onnxEncodes and decodes Base64-formatted constant…
permissive · top 15,000 on PyPI
simple-onnx-processing-toolsA collection of command-line tools for…
permissive · top 15,000 on PyPI
sng4onnxAutomatically generates and assigns operation…
permissive · top 15,000 on PyPI
ssc4onnxAnalyzes and displays the structure of ONNX…
permissive · top 15,000 on PyPI
sde4onnxRemoves embedded doc_strings from ONNX model…
permissive · top 15,000 on PyPI
sod4onnxsod4onnx removes specified output operations…
permissive · top 15,000 on PyPI
sio4onnxModifies the input and output shapes of ONNX…
permissive · top 15,000 on PyPI
ssi4onnxInfers and fills missing tensor shape…
permissive · top 15,000 on PyPI
soc4onnxChanges the opset version of an ONNX model…
permissive · top 15,000 on PyPI