Skip to content
| Marketplace
Sign in
Visual Studio Code>Formatters>JSONPlusNew to Visual Studio Code? Get it now.
JSONPlus

JSONPlus

tp-build-dev

|
1 install
| (0) | Free
Swiss knife for JSON operations - validate, format, minify, stringify, parse, and sort JSON
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

JSONPlus

Swiss knife for JSON operations - A VSCode extension and CLI tool for validating, formatting, minifying, stringifying, parsing, and sorting JSON.

Version License

Features

Feature Description Keyboard Shortcut
Validate Check if JSON is valid, with error position highlighting Ctrl+Alt+V / Cmd+Alt+V
Format Pretty-print JSON with customizable indentation Ctrl+Alt+F / Cmd+Alt+F
Minify Remove all whitespace for compact JSON Ctrl+Alt+M / Cmd+Alt+M
Stringify Escape special characters (quotes, backslashes, newlines) Ctrl+Alt+G / Cmd+Alt+G
Parse Convert stringified JSON back to formatted JSON Ctrl+Alt+P / Cmd+Alt+P
Sort Keys Sort object keys alphabetically (A-Z or Z-A) Ctrl+Alt+S / Cmd+Alt+S

Key Highlights

  • Selection Support: Apply operations to selected text or the entire document
  • Format Document Hook: Use VSCode's built-in "Format Document" (Shift+Alt+F) with JSONPlus
  • Context Menu: Right-click to access all operations via the JSONPlus submenu
  • Auto Language Detection: Automatically sets file language to JSON after operations
  • Detailed Error Messages: Shows exact line and column for JSON errors
  • CLI Tool: Use JSONPlus from the command line or in scripts

Usage

Via Command Palette

  1. Open a JSON file or select JSON text
  2. Press Ctrl+Shift+P / Cmd+Shift+P to open Command Palette
  3. Type "JSONPlus" to see all available commands

Via Context Menu

  1. Right-click in the editor
  2. Select "JSONPlus" from the context menu
  3. Choose the desired operation

Via Keyboard Shortcuts

Use the keyboard shortcuts listed in the features table above.

Selection Mode

Select a portion of text to apply operations only to that selection. If no selection is made, the operation applies to the entire document.

Examples

Validate JSON

// Input (invalid)
{"name": "John", "age": }

// Output: Error message
// "Invalid JSON at line 1, column 24: Unexpected token }"

Format JSON

// Input
{"name":"John","age":30,"city":"New York"}

// Output (with default 2-space indent)
{
  "name": "John",
  "age": 30,
  "city": "New York"
}

Minify JSON

// Input
{
  "name": "John",
  "age": 30
}

// Output
{"name":"John","age":30}

Stringify JSON

// Input
{"key": "value"}

// Output
"{\"key\": \"value\"}"

Parse Stringified JSON

// Input
"{\"key\": \"value\"}"

// Output
{
  "key": "value"
}

Sort Keys

// Input
{"zebra": 1, "apple": 2, "mango": 3}

// Output (ascending)
{
  "apple": 2,
  "mango": 3,
  "zebra": 1
}

Configuration

Configure JSONPlus via VSCode Settings (Ctrl+, / Cmd+,):

Setting Default Description
jsonplus.format.enable true Enable as formatting provider for Format Document
jsonplus.format.indentSize 2 Number of spaces for indentation
jsonplus.format.useTabs false Use tabs instead of spaces
jsonplus.format.insertFinalNewline true Add trailing newline when formatting
jsonplus.sortKeys.recursive true Sort keys in nested objects
jsonplus.sortKeys.order "ascending" Sort order: "ascending" or "descending"
jsonplus.autoSetLanguage true Auto-set language to JSON after operations
jsonplus.showNotifications true Show success/error notifications

Example Settings

{
  "jsonplus.format.indentSize": 4,
  "jsonplus.format.useTabs": true,
  "jsonplus.sortKeys.order": "descending"
}

CLI Usage

JSONPlus also provides a command-line interface.

Installation

npm install -g jsonplus-cli

Commands

# Validate JSON
jsonplus validate input.json

# Format JSON
jsonplus format input.json
jsonplus format --indent 4 input.json
jsonplus format --tabs input.json

# Minify JSON
jsonplus minify input.json
jsonplus minify input.json -o output.json

# Stringify
jsonplus stringify input.json

# Parse stringified JSON
jsonplus parse input.json

# Sort keys
jsonplus sort input.json
jsonplus sort --desc input.json
jsonplus sort --no-recursive input.json

Piping

# Pipe from stdin
echo '{"b":1,"a":2}' | jsonplus sort
cat data.json | jsonplus minify

# Output to file
cat data.json | jsonplus format -o formatted.json

CLI Options

Option Description
--indent <n> Indentation size in spaces (default: 2)
--tabs Use tabs instead of spaces
--desc Sort in descending order (Z-A)
--no-recursive Don't sort nested objects
--no-newline Don't add trailing newline
-o, --output Output file (default: stdout)
-h, --help Show help
-v, --version Show version

Supported File Types

  • .json - Standard JSON files
  • .jsonc - JSON with Comments (VSCode's format)

Future Support (Lower Priority)

  • .json5 - JSON5 extended format
  • .jsonl - JSON Lines (newline-delimited JSON)

Installation

From VS Code Marketplace

  1. Open VSCode
  2. Go to Extensions (Ctrl+Shift+X / Cmd+Shift+X)
  3. Search for "JSONPlus"
  4. Click Install

From Open VSX Registry

For VSCodium or other editors:

  1. Go to Open VSX Registry
  2. Search for "JSONPlus"
  3. Click Install

Development

Setup

git clone https://github.com/yourusername/jsonplus.git
cd jsonplus
npm install

Build

npm run compile

Test

npm run test

Package

npm run package

Publish

# VS Code Marketplace
npm run publish:vscode

# Open VSX Registry
npm run publish:ovsx

Architecture

JSONPlus/
├── src/
│   ├── extension.ts        # Extension entry point
│   ├── core/               # Pure logic (no VSCode deps)
│   │   ├── validator.ts
│   │   ├── formatter.ts
│   │   ├── minifier.ts
│   │   ├── stringifier.ts
│   │   ├── parser.ts
│   │   └── sorter.ts
│   ├── commands/           # VSCode command handlers
│   ├── providers/          # Formatting provider
│   └── utils/              # Helper utilities
└── cli/                    # CLI package

Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Run tests (npm test)
  5. Submit a pull request

License

MIT License - see LICENSE for details.

Changelog

See CHANGELOG.md for version history.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft