Skip to main content

# JData for Python - a lightweight and portable data annotation method

The [JData Specification](https://github.com/fangq/jdata/) defines a lightweight language-independent data annotation interface targetted at storing and sharing complex data structures across different programming languages such as MATLAB, JavaScript, Python etc. Using JData formats, a complex Python data structure can be encoded as a dict object that is easily serialized as a JSON/binary JSON file and share such data between programs of different languages.

## How to use

The PyJData module is easy to use. You can use the encode()/decode() functions to encode Python data into JData annotation format, or decode JData structures into native Python data, for example

` import jdata as jd import numpy as np a={'str':'test','num':1.2,'list':[1.1,[2.1]],'nan':float('nan'),'np':np.arange(1,5,dtype=np.uint8)} jd.encode(a) jd.decode(jd.encode(a)) d1=jd.encode(a,{'compression':'zlib','base64':1}) d1 jd.decode(d1,{'base64':1}) `

One can further save the JData annotated data into JSON or binary JSON (UBJSON) files using the jdata.save function, or loading JData-formatted data to Python using jdata.load

` import jdata as jd import numpy as np a={'str':'test','num':1.2,'list':[1.1,[2.1]],'nan':float('nan'),'np':np.arange(1,5,dtype=np.uint8)} jd.save(a,'test.json') newdata=jd.load('test.json') newdata `

Metadata

Release files for jdata 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for jdata 0.2.1
File Size Uploaded Provenance Actions
jdata-0.2.1.tar.gz 6.1 kB Without provenance Details for jdata-0.2.1.tar.gz

Release files / jdata-0.2.1.tar.gz

Download URL jdata-0.2.1.tar.gz
Size 6.1 kB
Tags Source
SHA-256 checksum
How to use checksums
2addca392ad5fd2f229f59eb12118c5fee6af1b8da2e17806a825ca9a5671807
BLAKE2b-256 checksum
How to use checksums
5b4ecaca7dea58b68b0e6c4e614a843d2f88b401dcebda0ec294db76660b7909
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.9.1

Security for jdata 0.2.1

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.

Release history Release notifications | RSS feed

This release

0.2.1 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page