JSON Collapsed Count
A VS Code extension that shows the count of elements in JSON objects and arrays.
Features
- Displays the number of items in arrays:
[ ...3 items... ]
- Shows the number of keys in objects:
{ ...5 keys... }
- Works with both JSON and JSONC (JSON with comments) files
- Option to show counts always or only when collapsed
- Lightweight and fast
Usage
- Open a JSON or JSONC file in VS Code
- The count of elements will appear next to each object and array
- Optionally, configure to show counts only when sections are collapsed
Configuration
| Setting |
Default |
Description |
jsonCollapsedCount.showOnlyWhenCollapsed |
false |
When enabled, shows the count only when the section is collapsed. When disabled, always shows the count. |
Example configuration
{
"jsonCollapsedCount.showOnlyWhenCollapsed": true
}
Example
With showOnlyWhenCollapsed: false (default), you'll always see:
{
"users": [
// [ ...3 items... ]
{ "id": 1, "name": "John" },
{ "id": 2, "name": "Jane" },
{ "id": 3, "name": "Doe" }
]
}
With showOnlyWhenCollapsed: true, counts appear only on collapsed sections.
Installation
From VS Code Marketplace
- Open VS Code
- Go to Extensions (
Ctrl+Shift+X)
- Search for "JSON Collapsed Count"
- Click Install
From VSIX file
- Download the
.vsix file
- Open VS Code
- Go to Extensions (
Ctrl+Shift+X)
- Click the
... menu → "Install from VSIX..."
- Select the downloaded file
License
MIT
| |