Extract nested values from dictionaries and JSON objects using clean dot notation.
pip install PyJget⭐ If you find this project useful, consider giving it a star on GitHub!
- 🚀 Lightning-fast nested JSON access
- 🎯 Simple dot notation (
user.profile.name) - 📦 Zero dependencies
- 🐍 Pure Python
- 💡 Beginner-friendly API
- ⚡ Lightweight and efficient
- ✅ Safe default values
- 🔥 Clean and readable code
data = {
"user": {
"profile": {
"name": "Alice",
"age": 22
}
}
}from pyjget import jget
name = jget(data, "user.profile.name")
age = jget(data, "user.profile.age")
print(name)
print(age)Alice
22
pip install PyJgetfrom pyjget import jget
data = {
"company": {
"employee": {
"name": "John"
}
}
}
print(jget(data, "company.employee.name"))Output
John
print(jget(data, "company.employee.salary", default=0))Output
0
data = {
"students": [
{"name": "Alice"},
{"name": "Bob"}
]
}
print(jget(data, "students.1.name"))Output
Bob
Instead of writing:
data["user"]["profile"]["name"]or
data.get("user", {}).get("profile", {}).get("name")Simply write:
jget(data, "user.profile.name")Cleaner.
Safer.
More readable.
jget(data, path, default=None)| Parameter | Description |
|---|---|
| data | Dictionary or JSON object |
| path | Dot notation path |
| default | Returned if path doesn't exist |
Returns:
- Value if found
defaultotherwise
- Nested dictionary support
- List indexing
- Wildcard support (
*) - Recursive search
- JSONPath compatibility
- Better error messages
- Performance improvements
Contributions are always welcome!
- Fork the repository
- Create a new branch
- Commit your changes
- Submit a Pull Request
MIT License
https://github.com/abeedalishaik1080-lab/PyJget
https://pypi.org/project/PyJget/