skillfed

onnx2json

Exports the ONNX file to a JSON file or JSON dict.

onnx2json v2.0.4 83.0K downloads/30d#14,111 on PyPI33
Permissive license MIT License Abandoned released

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 onnx2json

uv

uv add onnx2json

poetry

poetry add onnx2json

Installing 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

onnx to json conversionexport onnx model jsononnx file serializationneural network model format conversiononnx model inspection tool
model-serializationonnx-tools

More Artificial Intelligence packages