See the structure of any JSON instantly — without exposing sensitive data.
Working with APIs is painful:
- ❌ Huge JSON responses (1000+ lines)
- ❌ Deeply nested structures
- ❌ Sensitive data you cannot share
👉 jsonlens converts JSON into a clean, safe structure.
- 🔐 Safe — no real values, only structure
- ❓ Optional fields detection (
email?) - 🔄 Type merging (
int | str) - 📦 List compression (
... N more items) - ⚡ Fast / Sample / Full modes
pip install jsonlensfrom jsonlens import build_structure
import json
data = {
"users": [
{"id": 1, "name": "Alice"},
{"id": 2, "name": "Bob", "email": "bob@mail.com"}
]
}
result = build_structure(data, mode="full")
print(json.dumps(result, indent=2)){
"users": [
{
"id": "int",
"name": "str",
"email?": "str"
}
]
}email?→ optional field (not present in all items)int | str→ multiple possible types... N more items→ repeated structure compressed
build_structure(data, mode="fast") # first item only
build_structure(data, mode="sample") # few items
build_structure(data, mode="full") # full scan| Mode | Description |
|---|---|
| fast | fastest, less accurate |
| sample | balanced |
| full | most accurate |
data = {
"orders": [
{
"id": 1,
"items": [{"name": "Laptop"}, {"name": "Mouse"}]
},
{
"id": 2,
"items": [{"name": "Keyboard"}]
}
]
}
print(json.dumps(build_structure(data, mode="full"), indent=2)){
"orders": [
{
"id": "int",
"items": [
{
"name": "str"
},
"... 1 more items (same structure)"
]
},
"... 1 more items (same structure)"
]
}Instead of sharing real API data:
❌ Original:
{
"email": "user@gmail.com"
}✅ With jsonlens:
{
"email": "str"
}- Fork the repo
- Create a branch
- Make changes
- Open a Pull Request
If you find this useful:
- ⭐ Star the repository
- Share with other developers
MIT License