Skip to main content

jvalue - extract json value

Extract values from json data via simplified json path.

Install

pip install jvalue

Example

from jvalue import JsonValue

artist = {
    "name": "David Bowie",
    "albums": [
        {"title": "Ziggy Stardust", "year": 1972},
        {"title": "Blackstar", "year": 2016},
    ],
}

jv = JsonValue(artist)

assert jv.find("$") == artist
assert jv.find("") == artist
assert jv.find("albums[].title") == ["Ziggy Stardust", "Blackstar"]
assert jv.find("albums[*].year") == [1972, 2016]
assert jv.find("albums[0].year") == 1972
assert jv.find("albums[2].year") is None

or, you can use json_extract as a function directly

from jvalue import json_extract

assert json_extract(artist, "albums[0].title") == "Ziggy Stardust"

Release files for jvalue 0.1.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 jvalue 0.1.0
File Size Uploaded
jvalue-0.1.0.tar.gz 5.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for jvalue 0.1.0
File Interpreter ABI Platform
jvalue-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 8.4 kB

Release files / jvalue-0.1.0.tar.gz

Download URL jvalue-0.1.0.tar.gz
Size 5.5 kB
Tags Source
SHA-256 checksum
How to use checksums
ac790a85daa72a443e12aa9901e2a364bbc291e2f4560c137bde013fe9ee58ac
BLAKE2b-256 checksum
How to use checksums
1030102c8d0b2cb3e7f36584001d548e31db5c6ef8c74368796ea99c4e3b7577
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.32.3

Release files / jvalue-0.1.0-py3-none-any.whl

Download URL jvalue-0.1.0-py3-none-any.whl
Size 2.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0022701a8b9e033ed5253adeb3d031eab76f44d840a73b175b0f8c4682009d91
BLAKE2b-256 checksum
How to use checksums
0d4e1b25b2fb804a86753daf6c8997ab0aacfc31b02490afefe63e07b0687f38
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.32.3

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

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