Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>JSON HandlerNew to Visual Studio Code? Get it now.
JSON Handler

JSON Handler

Fadi abi khalil

|
1 install
| (0) | Free
Toggle an open JSON document between pretty (multi-line) and single-line (collapsed) formatting via an editor title button.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

JSON Handler

A lightweight VS Code extension that adds an editor title button for JSON / JSONC files to toggle between:

  1. Pretty formatted (multi-line, indented) JSON
  2. Single-line (collapsed) JSON – convenient for storing in single-line DB JSON columns or copying inline

Features

  • Icon button appears in the editor title when a JSON / JSONC file is active
  • Command palette access: JSON: Toggle JSON Format
  • Keybinding: Ctrl+Alt+J (override or change in Keyboard Shortcuts)
  • Safe: if the document content is not valid JSON, it will not modify it
  • Remembers last state per document during the session

Usage

Open any .json or .jsonc file and click the Toggle JSON Format button in the top-right of the editor (title area), or run the command / shortcut.

Installation (Development)

npm install
npm run watch
# Press F5 in VS Code to launch Extension Development Host

Packaging

npm run package

Notes

  • For JSONC (with comments / trailing commas), parsing will fail; enhancement could add a JSONC parser (e.g. jsonc-parser).
  • Currently uses a simple in-memory map; persistent state could be added if desired.

Roadmap Ideas

  • Support JSONC by stripping comments before parse
  • Status bar indicator of current mode
  • Auto-detect current mode instead of explicit state
  • Multi-selection formatting

License

MIT

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