JSON Path Copier

A VS Code/Cursor extension that allows you to quickly copy the internal key path of any JSON key by simply right-clicking or using a keyboard shortcut.
Features
- 🚀 Quick Copy: Copy JSON key paths with a single click
- 📋 Smart Detection: Automatically detects the key at your cursor position
- 🔍 Nested Support: Works with deeply nested JSON structures
- ⌨️ Keyboard Shortcut: Fast access via Command Palette
- 🎯 Context Menu: Right-click integration for easy access
Installation
Method 1: Install from VSIX File
- Download the
json-path-copier-0.1.0.vsix file
- Open VS Code or Cursor
- Press
Ctrl+Shift+P (or Cmd+Shift+P on Mac)
- Type
Extensions: Install from VSIX... and select it
- Choose the downloaded
.vsix file
- Reload VS Code/Cursor when prompted
Method 2: Development Mode
- Clone or download this repository
- Open the folder in VS Code/Cursor
- Press
F5 to launch Extension Development Host
- The extension will be active in the new window
Usage
- Open any JSON file (
.json or .jsonc)
- Place your cursor on the key you want to copy
- Right-click and select "Copy JSON Path"
- The path is now copied to your clipboard!
Method 2: Command Palette
- Place your cursor on the key you want to copy
- Press
Ctrl+Shift+P (or Cmd+Shift+P on Mac)
- Type
Copy JSON Path and press Enter
- The path is copied to your clipboard!
Examples
Example 1: Simple Nested Object
{
"user": {
"profile": {
"name": "John Doe",
"email": "john@example.com",
"settings": {
"theme": "dark",
"language": "en"
}
}
}
}
Results:
- Cursor on
"name" → Copies: user.profile.name
- Cursor on
"email" → Copies: user.profile.email
- Cursor on
"theme" → Copies: user.profile.settings.theme
- Cursor on
"language" → Copies: user.profile.settings.language
Example 2: Configuration File
{
"app": {
"name": "My Application",
"version": "1.0.0",
"database": {
"host": "localhost",
"port": 5432,
"credentials": {
"username": "admin",
"password": "secret"
}
},
"features": {
"darkMode": true,
"notifications": {
"enabled": true,
"sound": false
}
}
}
}
Results:
- Cursor on
"name" → Copies: app.name
- Cursor on
"host" → Copies: app.database.host
- Cursor on
"username" → Copies: app.database.credentials.username
- Cursor on
"enabled" → Copies: app.features.notifications.enabled
Example 3: API Response Structure
{
"status": "success",
"data": {
"users": [
{
"id": 1,
"name": "Alice"
}
],
"pagination": {
"page": 1,
"totalPages": 10,
"itemsPerPage": 20
}
},
"metadata": {
"timestamp": "2024-01-01T00:00:00Z",
"version": "v2.1"
}
}
Results:
- Cursor on
"status" → Copies: status
- Cursor on
"users" → Copies: data.users
- Cursor on
"page" → Copies: data.pagination.page
- Cursor on
"timestamp" → Copies: metadata.timestamp
Example 4: Complex Nested Structure
{
"company": {
"name": "Tech Corp",
"departments": {
"engineering": {
"team": {
"frontend": {
"lead": "Sarah",
"members": 5
},
"backend": {
"lead": "Mike",
"members": 8
}
}
},
"marketing": {
"budget": 50000,
"campaigns": {
"active": 3,
"planned": 5
}
}
}
}
}
Results:
- Cursor on
"name" → Copies: company.name
- Cursor on
"frontend" → Copies: company.departments.engineering.team.frontend
- Cursor on
"lead" (in frontend) → Copies: company.departments.engineering.team.frontend.lead
- Cursor on
"budget" → Copies: company.departments.marketing.budget
- Cursor on
"active" → Copies: company.departments.marketing.campaigns.active
How It Works
The extension:
- Detects your cursor position in the JSON file
- Parses the JSON structure to find the key at that position
- Builds the complete path from root to the selected key
- Copies the path in dot notation (e.g.,
parent.child.key)
Requirements
- VS Code or Cursor version 1.74.0 or higher
- JSON or JSONC file format
Keyboard Shortcut
- Windows/Linux:
Ctrl+Shift+J (or Ctrl+Shift+P → Type "Copy JSON Path")
- Mac:
Cmd+Shift+J (or Cmd+Shift+P → Type "Copy JSON Path")
Troubleshooting
Path not found
- Make sure your cursor is positioned on a key name (the left side of the colon)
- Ensure the JSON file is valid (no syntax errors)
- Try placing the cursor directly on the key name text
Extension not working
- Reload VS Code/Cursor after installation
- Check that the file has
.json or .jsonc extension
- Verify the extension is enabled in the Extensions panel
Contributing
Contributions are welcome! Please feel free to submit issues or pull requests.
Version
Current version: 0.1.0
License
This extension is licensed under the MIT License.
Support
If you encounter any issues or have feature requests, please open an issue on GitHub.
Enjoy faster JSON navigation! 🎉