Skip to main content

A Python class for searching within JSON data structures

Project description

JSON Search Engine

This is a Python class named JSONSearchEngine designed to facilitate searching within JSON data structures. The class provides methods to search for specific keys or values within JSON objects, as well as the ability to find occurrences of patterns using regular expressions.

Installation

Use the package manager pip to install foobar.

pip install JsonSearchEngine

Example Package

This is a simple example package. You can use GitHub-flavored Markdown to write your content.

Usage

from jsonsearch import JSONSearchEngine

# Example JSON data
data_json = {
    "name": "John",
    "age": 30,
    "address": {
        "city": "New York",
        "zipcode": "10001"
    },
    "emails": ["john@example.com", "john.doe@gmail.com"]
}

# Initialize JSONSearchEngine with JSON data
search_engine = JSONSearchEngine(data_json)

# Search for a specific key
key_results = search_engine.search_key("age")
print("Key results:", key_results)

# Search for a specific value
value_results = search_engine.search_value("New York")
print("Value results:", value_results)

# Find all occurrences of a pattern
pattern_results = search_engine.find_all(r'\b[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}\b')
print("Pattern results:", pattern_results)

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

JsonSearchEngine-1.0.0.tar.gz (3.1 kB view hashes)

Uploaded Source

Built Distribution

JsonSearchEngine-1.0.0-py3-none-any.whl (2.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page