JSON renderer for t-string structured data templates
Project description
json-tstring
JSON rendering for PEP 750 t-strings. Parsing and rendering happen in Rust; this package is the Python wrapper.
Requires Python 3.14+.
This package depends on tstring-bindings, a native PyO3 extension. On
supported platforms, install from prebuilt wheels. Other environments require a
local Rust 1.94.0 toolchain build.
API
render_data(template, profile="rfc8259") # -> Python data
render_text(template, profile="rfc8259") # -> JSON text
render_result(template, profile="rfc8259") # -> RenderResult (.text + .data)
Type alias: JsonProfile = Literal["rfc8259"]
Parsed template structure is cached per process using template.strings +
profile as the key.
How it works
The Python Template is converted to a Rust token stream, parsed into JSON
nodes (keeping interpolation visible in values, keys, and string fragments),
and rendered back to text or Python data. serde_json handles normalization.
Supported positions
- whole-value, object-key, quoted-key-fragment, and string-fragment interpolation
- bare fragments promoted to JSON strings
- nested arrays and objects, top-level values
Limits
- object keys must be
str - non-finite floats rejected
- values must be JSON-representable
- integers keep exact Python text (no silent
floatcoercion)
Verify
uv sync --group dev
uv run --group dev pytest
See also
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
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 json_tstring-0.2.0.tar.gz.
File metadata
- Download URL: json_tstring-0.2.0.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
459d2fbd9543914aaf2dd3a3e482ecf7616ff75e1ee59c5ffd49ed70ce31662b
|
|
| MD5 |
6c0c50c8af0c6ecfb4bd83dcdf190457
|
|
| BLAKE2b-256 |
70ccbec90ee8f79a24909bb131f437ac432bc193904a2e0fc32218dba65d12af
|
Provenance
The following attestation bundles were made for json_tstring-0.2.0.tar.gz:
Publisher:
publish-python.yml on koxudaxi/tstring-structured-data
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
json_tstring-0.2.0.tar.gz -
Subject digest:
459d2fbd9543914aaf2dd3a3e482ecf7616ff75e1ee59c5ffd49ed70ce31662b - Sigstore transparency entry: 1124409843
- Sigstore integration time:
-
Permalink:
koxudaxi/tstring-structured-data@05fa824a105cb87e90662f465cd0d744314fa863 -
Branch / Tag:
refs/tags/0.2.0 - Owner: https://github.com/koxudaxi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-python.yml@05fa824a105cb87e90662f465cd0d744314fa863 -
Trigger Event:
push
-
Statement type:
File details
Details for the file json_tstring-0.2.0-py3-none-any.whl.
File metadata
- Download URL: json_tstring-0.2.0-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ec5b64ab33f9670740a3f23a929e37bb3f0e69535bab60711323a9d8254e4fb7
|
|
| MD5 |
8317075f640b8dc777793d5cceb781a5
|
|
| BLAKE2b-256 |
f33bf7f638f0f213e0ad5138785f2326e95556ae0f40ab51e0297981e4a8777b
|
Provenance
The following attestation bundles were made for json_tstring-0.2.0-py3-none-any.whl:
Publisher:
publish-python.yml on koxudaxi/tstring-structured-data
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
json_tstring-0.2.0-py3-none-any.whl -
Subject digest:
ec5b64ab33f9670740a3f23a929e37bb3f0e69535bab60711323a9d8254e4fb7 - Sigstore transparency entry: 1124410137
- Sigstore integration time:
-
Permalink:
koxudaxi/tstring-structured-data@05fa824a105cb87e90662f465cd0d744314fa863 -
Branch / Tag:
refs/tags/0.2.0 - Owner: https://github.com/koxudaxi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-python.yml@05fa824a105cb87e90662f465cd0d744314fa863 -
Trigger Event:
push
-
Statement type: