JsonExtractor
JsonExtractor is a Python utility designed to extract valid JSON objects from strings. This is particularly useful for processing outputs from various sources where JSON objects may be embedded within larger text blobs.
Installation
To install JsonExtractor, you can use pip:
pip install jsonextractor
Usage
After installation, JsonExtractor can be imported and used in your Python projects to extract JSON objects from strings.
Example:
from json_extractor import JsonExtractor
# Some input string that contains a JSON object
input_string = 'Some text before JSON {"key": "value"} some text after JSON.'
# Extract the valid JSON object
valid_json = JsonExtractor.extract_valid_json(input_string)
if valid_json is not None:
print("Extracted JSON:", valid_json)
else:
print("No valid JSON found.")
Features
- Extracts the first valid JSON object found in a given string.
- Handles various formats, including JSON within markdown code blocks.
Contributing
Contributions, issues, and feature requests are welcome! Feel free to check issues page.
License
Metadata
Release files for JsonExtractor 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| JsonExtractor-0.0.2.tar.gz | 3.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| JsonExtractor-0.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.4 kB
Release files / JsonExtractor-0.0.2.tar.gz
| Download URL | JsonExtractor-0.0.2.tar.gz |
|---|---|
| Size | 3.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d0a406d99fbb60684b55febf3e14dc012061f6b4bda549b010d5f7b0c3b6a8ea
|
|
BLAKE2b-256 checksum How to use checksums |
de36bb6b1cc3f9cb10b0658102b22a5867527e677395d8fc697ae45db930d786
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.9
|
Release files / JsonExtractor-0.0.2-py3-none-any.whl
| Download URL | JsonExtractor-0.0.2-py3-none-any.whl |
|---|---|
| Size | 4.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6c03712a5f62b85cfaaf5a16648452159e540ec52ccc959f328b7e2c198edac8
|
|
BLAKE2b-256 checksum How to use checksums |
251509238c0e0e3beabd27a1e3fb815b703773560c156e95de4ff752186f8b7e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.9
|