Analizador de Estructura JSON
Analiza métricas de estructura JSON: cuenta objetos, arrays, claves, profundidad máxima y detecta problemas
Analyzing JSON Structure and Complexity Metrics
Understanding the structural complexity of JSON documents helps teams make informed decisions about API design, database schema choices, and data processing strategies. A JSON payload that appears simple at the surface may contain deeply nested objects, inconsistent array element types, or thousands of repeated keys that indicate denormalization issues or schema drift. The JSON Structure Analyzer provides a bird's-eye view of your document's composition — counting objects, arrays, keys, measuring maximum nesting depth, and detecting structural anomalies.
Paste any JSON document and receive comprehensive metrics: total node counts by type, maximum and average nesting depth, key frequency analysis, array homogeneity checks, and potential issues like repeated keys within objects or inconsistent types across array elements. These insights inform whether a response payload needs pagination, whether a nested structure should be flattened, or whether schema validation is needed to catch structural drift.
Structural Metrics and Counts
The analyzer computes key metrics that describe document complexity:
- Total nodes: Combined count of all objects, arrays, and primitive values
- Object count: Number of
{}containers in the document - Array count: Number of
[]containers with their element counts - Maximum depth: The deepest nesting level (objects within objects within arrays)
- Average depth: Mean nesting level across all leaf values
- Unique keys: Total distinct property names used across all objects
- Total string length: Combined character count of all string values
These metrics immediately reveal whether a document is shallow and wide (many top-level keys), deep and narrow (deeply nested single paths), or balanced — each pattern suggesting different processing strategies.
Detecting Structural Issues
Beyond metrics, the analyzer identifies structural patterns that may indicate problems:
- Repeated keys: The same key appearing multiple times within a single object (valid JSON per spec but usually a bug, later values overwrite earlier ones)
- Inconsistent array types: Arrays containing mixed types (strings and numbers, or objects with different shapes) suggesting missing schema validation
- Oversized arrays: Arrays with hundreds or thousands of elements that may indicate missing pagination
- Excessive depth: Nesting beyond 10-15 levels suggests over-denormalization or recursive data structures
- Empty containers: Empty objects
{}or arrays[]that may indicate null handling issues
Use Cases for Structure Analysis
Structure analysis serves several development workflows:
- API design review: Evaluate whether response payloads are appropriately sized and structured for client consumption
- Schema validation planning: Identify which parts of a JSON structure need validation rules based on inconsistency patterns
- Performance optimization: Find oversized arrays that need pagination or deeply nested structures that need flattening
- Data migration planning: Understand source data complexity before designing target schemas
- Documentation: Generate structural summaries for API documentation describing expected response shapes
Code Examples
Structure Analysis Output Example
// Input: Complex API response
// Analysis output:
{
"metrics": {
"totalNodes": 1247,
"objects": 89,
"arrays": 23,
"strings": 456,
"numbers": 312,
"booleans": 67,
"nulls": 12,
"maxDepth": 7,
"avgDepth": 3.2,
"uniqueKeys": 42
},
"issues": [
{
"type": "inconsistent-array",
"path": "$.users[*].metadata",
"detail": "Array contains both objects and strings"
},
{
"type": "oversized-array",
"path": "$.events",
"detail": "Array has 500 elements — consider pagination"
}
]
}