JsonExtractor


NameJsonExtractor JSON
Version 0.0.2 PyPI version JSON
download
home_pagehttps://github.com/chigwell/JsonExtractor
SummaryA tool for extracting valid JSON from LLM responses
upload_time2024-07-07 10:22:12
maintainerNone
docs_urlNone
authorEugene Evstafev
requires_python>=3.6
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![PyPI version](https://badge.fury.io/py/jsonextractor.svg)](https://badge.fury.io/py/jsonextractor)
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
[![Downloads](https://static.pepy.tech/badge/jsonextractor)](https://pepy.tech/project/jsonextractor)

# 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:

```bash
pip install jsonextractor
```

## Usage

After installation, `JsonExtractor` can be imported and used in your Python projects to extract JSON objects from strings.

Example:

```python
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](https://github.com/chigwell/jsonextractor/issues).

## License

[MIT](https://choosealicense.com/licenses/mit/)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/chigwell/JsonExtractor",
    "name": "JsonExtractor",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": null,
    "author": "Eugene Evstafev",
    "author_email": "chigwel@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/de/36/bb6b1cc3f9cb10b0658102b22a5867527e677395d8fc697ae45db930d786/JsonExtractor-0.0.2.tar.gz",
    "platform": null,
    "description": "[![PyPI version](https://badge.fury.io/py/jsonextractor.svg)](https://badge.fury.io/py/jsonextractor)\n[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)\n[![Downloads](https://static.pepy.tech/badge/jsonextractor)](https://pepy.tech/project/jsonextractor)\n\n# JsonExtractor\n\n`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.\n\n## Installation\n\nTo install `JsonExtractor`, you can use pip:\n\n```bash\npip install jsonextractor\n```\n\n## Usage\n\nAfter installation, `JsonExtractor` can be imported and used in your Python projects to extract JSON objects from strings.\n\nExample:\n\n```python\nfrom json_extractor import JsonExtractor\n\n# Some input string that contains a JSON object\ninput_string = 'Some text before JSON {\"key\": \"value\"} some text after JSON.'\n\n# Extract the valid JSON object\nvalid_json = JsonExtractor.extract_valid_json(input_string)\n\nif valid_json is not None:\n    print(\"Extracted JSON:\", valid_json)\nelse:\n    print(\"No valid JSON found.\")\n```\n\n## Features\n\n- Extracts the first valid JSON object found in a given string.\n- Handles various formats, including JSON within markdown code blocks.\n\n## Contributing\n\nContributions, issues, and feature requests are welcome! Feel free to check [issues page](https://github.com/chigwell/jsonextractor/issues).\n\n## License\n\n[MIT](https://choosealicense.com/licenses/mit/)\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A tool for extracting valid JSON from LLM responses",
    "version": "0.0.2",
    "project_urls": {
        "Homepage": "https://github.com/chigwell/JsonExtractor"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "251509238c0e0e3beabd27a1e3fb815b703773560c156e95de4ff752186f8b7e",
                "md5": "df34bb9c261ac82d42d876b3ac58b97d",
                "sha256": "6c03712a5f62b85cfaaf5a16648452159e540ec52ccc959f328b7e2c198edac8"
            },
            "downloads": -1,
            "filename": "JsonExtractor-0.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "df34bb9c261ac82d42d876b3ac58b97d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 4578,
            "upload_time": "2024-07-07T10:22:11",
            "upload_time_iso_8601": "2024-07-07T10:22:11.123460Z",
            "url": "https://files.pythonhosted.org/packages/25/15/09238c0e0e3beabd27a1e3fb815b703773560c156e95de4ff752186f8b7e/JsonExtractor-0.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "de36bb6b1cc3f9cb10b0658102b22a5867527e677395d8fc697ae45db930d786",
                "md5": "b648156ed11d893a4c9b4525e1b42ba8",
                "sha256": "d0a406d99fbb60684b55febf3e14dc012061f6b4bda549b010d5f7b0c3b6a8ea"
            },
            "downloads": -1,
            "filename": "JsonExtractor-0.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "b648156ed11d893a4c9b4525e1b42ba8",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 3860,
            "upload_time": "2024-07-07T10:22:12",
            "upload_time_iso_8601": "2024-07-07T10:22:12.239815Z",
            "url": "https://files.pythonhosted.org/packages/de/36/bb6b1cc3f9cb10b0658102b22a5867527e677395d8fc697ae45db930d786/JsonExtractor-0.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-07 10:22:12",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "chigwell",
    "github_project": "JsonExtractor",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "jsonextractor"
}
        
Elapsed time: 1.31329s