JSONParser is a lightweight Python utility that enables easy flattening and inflating of complex/nested JSON data. Additionally, it provides a flexible search mechanism over JSON structures.
- 🔽 Flatten deeply nested JSON into a flat dictionary.
- 🔼 Inflate flat JSON into the original structure.
- 🔍 Search functionality includes:
- Keyword search with options for:
- Case sensitivity
- Fuzzy matching (via
difflib) - Filtering by keys or values
- Multi-word query search:
- Ranks results based on how many words match
- Customisable number of top results (
n_results)
- Keyword search with options for:
Clone the repository and ensure you have Python 3.x installed.
git clone https://github.com/DevBhuyan/JSONParser.git
cd JSONParserOr download the source code using:
wget
wget https://github.com/DevBhuyan/JSONParser/archive/refs/tags/linux-binary.zipcurl
curl -LO https://github.com/DevBhuyan/JSONParser/archive/refs/tags/linux-binary.zipEnsure you have a complex_json.json file in the same directory.
Run the script:
python main.pyfrom main import (
flatten_data,
inflate_data,
search_by_keyword,
search_by_query
)
flat = flatten_data(nested_dict)
nested = inflate_data(flat)
# Basic keyword search
search_results = search_by_keyword(flat, "source", close_matches=True)
# Multi-word search
query_results = search_by_query("document sensitive policy", flat, n_results=10){
"user": {
"name": "Dev",
"roles": ["admin", "editor"]
},
"meta": {
"created": "2025-06-01"
}
}{
"user.name": "Dev",
"user.roles.0": "admin",
"user.roles.1": "editor",
"meta.created": "2025-06-01"
}MIT License
Devvjiit Bhuyan, Dhananjoy Bhuyan