JSON exporter plugin for vcti-tree-exporter: writes a vcti tree to a single .json document (nested nodes carrying name, attributes, and light arrays as JSON lists).
Project description
JSON Tree Exporter
JSON exporter plugin for vcti-tree-exporter: writes a vcti tree to a single .json document.
JsonExporter serializes any vcti-tree
tree whose node payloads are
vcti-datanode DataNodes
to one JSON document that mirrors the tree, and ships a
get_exporter_descriptor() factory so a consumer registers it in a catalog and
resolves it by id ("json") or by attribute lookup.
JSON is a natural fit for structure, metadata, and light arrays — simulation settings, CAE metadata, input decks — that load straight into tooling. It is a poor fit for large numeric arrays (they become bulky nested lists); use HDF5 or NPZ for heavy data.
Installation
pip install vcti-tree-exporter-json
This pulls in vcti-tree-exporter (the protocol/catalog) and numpy.
Tree → JSON mapping
Each node becomes an object; the document root is the tree's root node:
{
"name": "model",
"attributes": {"solver": "abaqus"},
"children": [
{"name": "info", "attributes": {"count": 7}},
{"name": "displacement", "attributes": {}, "data": [1.0, 2.0, 3.0]}
]
}
| Tree node part | JSON |
|---|---|
node.name |
"name" (the structural name; null if unset) |
node.attributes |
"attributes" object (always present) |
node.load() array |
"data" as nested lists (present only for data nodes) |
| children | "children" array (present only when non-empty) |
A node may carry both data and children. Attribute values are JSON-encoded
(bytes decoded, numpy scalars/arrays converted to numbers/lists); anything not
natively serializable falls back to its str(). Array dtype is not preserved —
the export is one-way.
Usage
from pathlib import Path
from vcti.tree.exporter.core import build_registry, get_exporter
from vcti.tree.exporter.json import get_exporter_descriptor
registry = build_registry([get_exporter_descriptor()]) # plus any other format plugins
get_exporter(registry, "json").export(tree, Path("model.json"), overwrite=True)
Or use the exporter directly:
from vcti.tree.exporter.json import JsonExporter
JsonExporter().export(tree, Path("model.json"))
Dependencies
- vcti-tree-exporter — the
Exporterprotocol and theExporterDescriptorcatalog. - vcti-tree / vcti-datanode — the tree and payload types.
- numpy. (JSON encoding itself uses only the standard library.)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file vcti_tree_exporter_json-2.0.0.tar.gz.
File metadata
- Download URL: vcti_tree_exporter_json-2.0.0.tar.gz
- Upload date:
- Size: 7.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
60b06e8e4c626424c0f122675623b9fb0e2e4fbb74fadb62168bb741835c4893
|
|
| MD5 |
15d6de87a6f3496923fd70d6f67c2cf4
|
|
| BLAKE2b-256 |
cff72c71bf2d206d4d48b90681862d3b8ef376df58060b41be5988b8b77133a5
|
Provenance
The following attestation bundles were made for vcti_tree_exporter_json-2.0.0.tar.gz:
Publisher:
release.yml on vcollab/vcti-python-tree-exporter-json
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vcti_tree_exporter_json-2.0.0.tar.gz -
Subject digest:
60b06e8e4c626424c0f122675623b9fb0e2e4fbb74fadb62168bb741835c4893 - Sigstore transparency entry: 1983057184
- Sigstore integration time:
-
Permalink:
vcollab/vcti-python-tree-exporter-json@13ce41ada083e01d8d1bba42ad28e39eab3d3fdd -
Branch / Tag:
refs/tags/v2.0.0 - Owner: https://github.com/vcollab
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@13ce41ada083e01d8d1bba42ad28e39eab3d3fdd -
Trigger Event:
push
-
Statement type:
File details
Details for the file vcti_tree_exporter_json-2.0.0-py3-none-any.whl.
File metadata
- Download URL: vcti_tree_exporter_json-2.0.0-py3-none-any.whl
- Upload date:
- Size: 6.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4090952cbafb30194e8c31407d4be96a236681c68794ffb8e81cee7814923bd0
|
|
| MD5 |
de66868b31339f1d6546d2c683077c5b
|
|
| BLAKE2b-256 |
02608e99ffb4fc5bf8093eff9db2bab522dd5bf26c9a79cc82c0d7e3a829355d
|
Provenance
The following attestation bundles were made for vcti_tree_exporter_json-2.0.0-py3-none-any.whl:
Publisher:
release.yml on vcollab/vcti-python-tree-exporter-json
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vcti_tree_exporter_json-2.0.0-py3-none-any.whl -
Subject digest:
4090952cbafb30194e8c31407d4be96a236681c68794ffb8e81cee7814923bd0 - Sigstore transparency entry: 1983057221
- Sigstore integration time:
-
Permalink:
vcollab/vcti-python-tree-exporter-json@13ce41ada083e01d8d1bba42ad28e39eab3d3fdd -
Branch / Tag:
refs/tags/v2.0.0 - Owner: https://github.com/vcollab
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@13ce41ada083e01d8d1bba42ad28e39eab3d3fdd -
Trigger Event:
push
-
Statement type: