
Product
Secure Your AI-Generated Code with Socket MCP
Socket MCP brings real-time security checks to AI-generated code, helping developers catch risky dependencies before they enter the codebase.
A versatile Python package for data extraction from JSON-like structures with user-defined format keys, enhanced with synonym retrieval capabilities.
Complex Parser is a powerful Python package designed to streamline the process of data extraction from JSON-like structures while also enriching the extracted data with synonym retrieval capabilities. Whether you're working with complex nested JSON data or simple dictionaries, this package provides a flexible and intuitive solution for extracting specific data elements based on user-defined format keys, all while expanding the semantic richness of your data through synonym retrieval.
You can install Complex Parser via pip:
pip install complex-parser
Here's a simple example demonstrating how to use the package
from complex_parser import extract_data
# Example data
data = {
"people":[
{
"name": "John",
"age": 30,
"address": {
"road": "123 Main St",
"city": "Anytown"
}
},
{
"name": "Joshua",
"age": 3100,
"address": {
"road": "657 Loud St",
"city": "Basictown",
"landmark": "Town Square"
}
},
{
"name": "John",
"age": 30,
"location": {
"road": "8474 Main St",
"city": "None"
}
},
{
"fullname": "Job",
"age": 27,
"destination": {
"road": "8474 John's St",
"city": "London"
}
},
{
"unknown": "Job",
"age": 27,
"destination": {
"road": "8474 John's St",
"city": "London"
}
}
]
}
format_keys = ["name", "address"]
load_lists= {
"address":[
"location"
],
"name": [
"fullname"
]
}
# Extract data with specified format keys
extracted_data = extract_data(data=data, format_keys=format_keys,load_lists=load_lists)
print(extracted_data)
results:
[{'name': 'John', 'age': 30, 'address': {'road': '123 Main St', 'city': 'Anytown'}}, {'name': 'Joshua', 'age': 3100, 'address': {'road': '657 Loud St', 'city': 'Basictown', 'landmark': 'Town Square'}}, {'name': 'John', 'age': 30, 'location': {'road': '8474 Main St', 'city': 'None'}}, {'fullname': 'Job', 'age': 27, 'destination': {'road': "8474 John's St", 'city': 'London'}}]
This project is licensed under the Mozilla Public License Version 2.0 - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit bug reports, feature requests, or pull requests on the GitHub repository.
FAQs
A versatile Python package for data extraction from JSON-like structures with user-defined format keys, enhanced with synonym retrieval capabilities.
We found that complex-parser demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket MCP brings real-time security checks to AI-generated code, helping developers catch risky dependencies before they enter the codebase.
Security News
As vulnerability data bottlenecks grow, the federal government is formally investigating NIST’s handling of the National Vulnerability Database.
Research
Security News
Socket’s Threat Research Team has uncovered 60 npm packages using post-install scripts to silently exfiltrate hostnames, IP addresses, DNS servers, and user directories to a Discord-controlled endpoint.