ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Json​5​Formatter

by RAMBOO1990 ST4

No description provided

Details

Installs

  • Total 2K
  • Win 651
  • Mac 854
  • Linux 231
Oct 12 Oct 11 Oct 10 Oct 9 Oct 8 Oct 7 Oct 6 Oct 5 Oct 4 Oct 3 Oct 2 Oct 1 Sep 30 Sep 29 Sep 28 Sep 27 Sep 26 Sep 25 Sep 24 Sep 23 Sep 22 Sep 21 Sep 20 Sep 19 Sep 18 Sep 17 Sep 16 Sep 15 Sep 14 Sep 13 Sep 12 Sep 11 Sep 10 Sep 9 Sep 8 Sep 7 Sep 6 Sep 5 Sep 4 Sep 3 Sep 2 Sep 1 Aug 31 Aug 30 Aug 29 Aug 28
Windows 12 6 3 9 9 4 9 9 3 3 10 13 8 16 13 4 2 13 8 12 13 10 6 4 5 10 8 8 9 3 7 12 5 13 10 13 3 5 13 18 7 11 11 0 4 3
Mac 12 4 3 13 17 7 9 13 3 6 8 13 17 15 23 1 7 12 14 8 15 21 10 3 6 16 15 13 4 3 3 9 18 12 10 11 3 8 11 15 16 20 12 4 3 11
Linux 3 4 3 3 2 1 4 3 2 1 2 4 3 5 1 1 2 4 5 3 6 5 0 2 3 4 9 3 2 0 1 3 4 3 4 2 3 2 6 2 6 7 5 1 1 5

Readme

Source
raw.​githubusercontent.​com

English | 中文

Json5Formatter

A Sublime Text plugin that formats JSON/JSON5 files using the system Python's json5 library.

Features

Command Description
JSON5: Format as JSON Format and output standard JSON, preserving comments
JSON5: Format as JSON5 Format as JSON5 style (comments not preserved)
JSON5: Minify Compress to single-line JSON
  • Supports JSON5 syntax: // and /* */ comments, single-quoted strings, trailing commas, unquoted keys
  • Auto-converts single quotes → double quotes, unquoted keys → quoted keys
  • Outputs standard JSON (no trailing commas)

Installation

Prerequisites

  • Python 3.x (on system PATH)
  • json5 library: pip install json5

Package Control (Recommended)

Search for Json5Formatter in Package Control:

  1. Ctrl+Shift+P → Package Control: Install Package
  2. Type Json5Formatter → Enter

Manual Install

Sublime Text 4

cd <Packages directory>   (Preferences → Browse Packages...)
git clone git@github.com:RAMBOO1990/sublime-json5.git "Json5Formatter"

Usage

Command Palette

Press Ctrl+Shift+P, type JSON5:, and select the desired command.

Key Binding

Keys Command
Ctrl+Shift+J Format as JSON

Customize in Default.sublime-keymap.

Settings

Preferences → Package Settings → Json5Formatter → Settings

{
    // Number of spaces per indent level
    "indent": 4,
    // Sort object keys alphabetically
    "sort_keys": false,
    // Escape non-ASCII characters
    "ensure_ascii": false
}

sort_keys and ensure_ascii only apply to the Format as JSON5 and Minify commands. Format as JSON uses the built-in formatter and does not currently support these options.

License

MIT