JSON-Transform
Json Transform allows you to simply convert your Python objects into a JSON document and vice versa.
New? Here is some help:
Example
Setup your object/entity.
from jsontransform import field, JSONObject
class Customer(JSONObject):
def __init__(self):
self._first_name = ""
# set a custom name for the field because by default it will be the function name
@property
@field("firstName")
def first_name(self):
return self._first_name
@first_name.setter
def first_name(self, value):
self._first_name = value
Instantiate the object and encode it to a JSON document.
from jsontransform import dumpd, dump, dumps
new_customer = Customer()
new_customer.first_name = "Peter"
# get a dict representation of the object
dumpd(new_customer)
# result: {"firstName": "Peter"}
# get an str with with our encoded object
dumps(new_customer)
# result: '{"firstName": "Peter"}'
# we can also encode the object directly into a file
with open("new_customer.json", "w") as f:
dump(new_customer, f)
JSON file (new_customer.json):
{
"firstName": "Peter"
}
Decode a JSON document.
Code:
from jsontransform import load, loadd, loads
# we can decode our customer object from a JSON file
with open("new_customer.json", "r") as f:
customer = load(f)
# or a dict
customer = loadd({"firstName": "Peter"})
# or an str as well
customer = loads("{'firstName': 'Peter'}")
customer.first_name
# result: Peter
More
- Check out the documentation.
- Check out the history
- Check out the API design
Metadata
Release files for json-transform 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| json-transform-1.0.1.tar.gz | 7.7 kB | Without provenance | Details for json-transform-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| json_transform-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for json_transform-1.0.1-py3-none-any.whl |
Total release size: 15.0 kB
Release files / json-transform-1.0.1.tar.gz
| Download URL | json-transform-1.0.1.tar.gz |
|---|---|
| Size | 7.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2ae31041996a4c9f95aba25925d760706f3dcf27a541e8380c30b008ee730f36
|
|
BLAKE2b-256 checksum How to use checksums |
d7b4376be8e55d41cf1c4d686603ab6ded1e4d9a3b7344c6b6dd5f7a79d1c6c1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.1.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.5
|
Release files / json_transform-1.0.1-py3-none-any.whl
| Download URL | json_transform-1.0.1-py3-none-any.whl |
|---|---|
| Size | 7.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
af0ad3b8d169fb2ffe24fd3b1320e340eef46f7c0cfd6e5abe33732eb7f1f684
|
|
BLAKE2b-256 checksum How to use checksums |
594dd8be0297d7ef047ebf0207dddfb501ed3879a55d18629996a730612a0284
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.1.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.5
|
Security for json-transform 1.0.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.