A module for safe JSON handling in Python
Example Usage:
data.json:
{
"person": {
"name": "John Doe",
"age": 30,
"city": "New York"
},
"company": {
"name": "Acme Inc.",
"employees": 500
}
}
import kokojson as json1
# Load the JSON data from the file
with open("data.json", "r") as file:
data = file.read()
# Parse the JSON data using kokojson
json_data = json1.load(data)
# Access existing keys
print(json_data.get("person").get("name")) # Output: John Doe
print(json_data.get("company").get("employees")) # Output: 500
# Access non-existing keys (returns None instead of raising an exception)
print(json_data.get("person").get("email")) # Output: None
print(json_data.get("company").get("website")) # Output: None
# Provide a default value for non-existing keys
print(json_data.get("person").get("email", "No email found")) # Output: No email found
print(json_data.get("company").get("website", "https://example.com")) # Output: https://example.com
Metadata
Release files for kokojson 0.1.5
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 | |
|---|---|---|---|---|
| kokojson-0.1.5.tar.gz | 2.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| kokojson-0.1.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 5.8 kB
Release files / kokojson-0.1.5.tar.gz
| Download URL | kokojson-0.1.5.tar.gz |
|---|---|
| Size | 2.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
38b8462da7279e5a7b2638601692a54792ab76b49424fdb8f968b8de44b65943
|
|
BLAKE2b-256 checksum How to use checksums |
7fe8f2325b4e1ef65141ad4d9b0a299735f2fa379927deab4025f1ecf86becda
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.11.3
|
Release files / kokojson-0.1.5-py3-none-any.whl
| Download URL | kokojson-0.1.5-py3-none-any.whl |
|---|---|
| Size | 3.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
67f9e2909e3d83c3fdccf56558975d1dacc136c2a4ec5793d62c2fdcaf218865
|
|
BLAKE2b-256 checksum How to use checksums |
d8e012c8e4ce118817e37569c366a40ce2bb05ead7d947030264943a20a5a661
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.11.3
|
Security for kokojson 0.1.5
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.