Skip to main content

JSON->URL PYthon implementation

https://img.shields.io/github/license/cdleonard/jsonurl-py.svg https://img.shields.io/pypi/v/jsonurl-py.svg https://github.com/cdleonard/jsonurl-py/actions/workflows/main.yml/badge.svg https://cdleonard.github.io/jsonurl-py/htmlcov/badge.svg https://img.shields.io/badge/code%20style-black-000000.svg

About

This is a python implementation of jsonurl, an alternative text format which encodes the same data model in a way that is more suitable for use in URLs.

See https://jsonurl.org/ and especially https://github.com/jsonurl/specification/

The following optional features are supported:

  • 2.9.1 Implied Arrays

  • 2.9.2 Implied Objects

  • 2.9.5 Distinction between empty object and array

  • 2.9.6 AQF - Address Bar Query String Friendly

The following optional features are not yet supported:

  • 2.9.3 WFU - x-www-form-urlencoded Arrays and Objects

  • 2.9.4 Implied Object Missing Values

Installation

pip install jsonurl-py

The package name is jsonurl_py to avoid confusion with an unrelated jsonurl package on pypi which implements an unrelated syntax. In theory you can install and import both packages without having them interfere with each other.

The project name uses a dash in the name for consistency with the existing jsonurl-js and jsonurl-java implementations.

Usage

import jsonurl_py as jsonurl

assert jsonurl.loads('(a:1,b:c)') == {'a': 1, 'b': 'c'}
assert jsonurl.dumps(dict(a=[1,2])) == '(a:(1,2))'

Command Line Interface

The package includes a command line interface for converting between jsonurl and standard json:

$ echo "(a:b)" | jsonurl-py load
{"a": "b"}
$ echo '{"a":"b"}' | jsonurl-py dump
(a:b)

It is also possible to run the executable directly via pipx:

$ echo '(a:b)' | pipx run jsonurl-py load
{"a": "b"}

Documentation

Published on github pages.

Can be built locally using tox -e docs

Testing

Tests run via github actions.

Code coverage for main branch is published on github pages.

Metadata

Release files for jsonurl-py 0.4.0

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

Source distribution (sdist)

Source distribution for jsonurl-py 0.4.0
File Size Uploaded Provenance
jsonurl-py-0.4.0.tar.gz 17.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for jsonurl-py 0.4.0
File Interpreter ABI Platform
jsonurl_py-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 25.3 kB

Release files / jsonurl-py-0.4.0.tar.gz

Download URL jsonurl-py-0.4.0.tar.gz
Size 17.4 kB
Tags Source
SHA-256 checksum
How to use checksums
1f78cf7c74a0aa8a71fefa1727b27d1b733466068985d1cc07f46b1240077a74
BLAKE2b-256 checksum
How to use checksums
9c464cfd51cbc21608141375395c66320242152abbe829e1bec902b75f39c065
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.27.1

Release files / jsonurl_py-0.4.0-py3-none-any.whl

Download URL jsonurl_py-0.4.0-py3-none-any.whl
Size 7.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
69c733bf1dd95f3c46831f88794a6a2ec47bc34567ff0293991b2063492823aa
BLAKE2b-256 checksum
How to use checksums
809e039863a27ad26e884df02a1c1a998e92290c860badf9e70c773a9d1d9df7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.27.1

Security for jsonurl-py 0.4.0

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.

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