Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Sort JS object keysNew to Visual Studio Code? Get it now.
Sort JS object keys

Sort JS object keys

Xingxin Zeng

|
68,474 installs
| (21) | Free
An extension to sort the js object keys
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Sort JS Object Keys README

This is a VS code extension to alphabetically sort the keys in selected js objects keys in your code.

It supports:

  • The latest ECMAScript version enabled by default (ES2017).
  • Typescript.
  • Comment attachment.

Usage

Usage animation

  1. Select a js object in your source
    Note: it uses full lines so ensure the selected lines are a valid js object, start from the "{" and end from the "}"
  2. Run the extension command
    • Sort JS object keys
      Keybinding: Alt+S
    • Sort JS object keys (Reverse)

Reference

Use @babel/parser to parse the code, and sort the parsed code, then use @babel/generator to genertate the code back to document

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