Skip to content

rjocoleman/JsonExtractor

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PyPI version License: MIT Downloads

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

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%