This is a VS Code extension that provides JSON formatting, compression, and text escaping capabilities for developers working with JSON files. This project is developed purely using Qwen Code and Lingma Code Assistant. The development process is in the series of articles published on My Blog.
This extension provides four main features for working with JSON files:
- Format JSON: Pretty-prints your JSON with proper indentation and spacing.
- Compact JSON: Removes all unnecessary whitespace from your JSON to make it compact.
- Escape JSON Text: Escapes special characters in JSON text for use in strings.
- Unescape JSON Text: Unescapes JSON text to convert it back to its original form.
All commands can be accessed through:
- The Command Palette (Ctrl+Shift+P or Cmd+Shift+P)
- The context menu when right-clicking in a JSON file (under the "CodeJsonX" submenu)
- The editor title bar menu when working with a JSON file (under the "CodeJsonX" submenu)
Converts compact JSON into a well-formatted, readable format with proper indentation.
Removes all unnecessary whitespace from JSON to create a compact representation.
Converts regular text into properly escaped JSON text that can be safely included in JSON strings.
Example:
{"a":"x","b":1,"c":true}Becomes:
{\"a\":\"x\",\"b\":1,\"c\":true}Note: When escaping, the entire selected text is treated as a string value and properly escaped for use within JSON.
Converts escaped JSON text back to its original form.
Example:
{\"a\": \"x\\nnewline\", \"b\": 1, \"c\": true}Becomes:
{"a": "x
newline", "b": 1, "c": true}No special requirements. This extension works with standard VS Code installations.
This extension does not contribute any VS Code settings.
None at this time.
- Fixed packaging issue where command files were not included in the extension package
- Improved documentation and examples
Initial release with JSON formatting, compaction, escaping, and unescaping features.
Ensure that you've read through the extensions guidelines and follow the best practices for creating your extension.
You can author your README using Visual Studio Code. Here are some useful editor keyboard shortcuts:
- Split the editor (
Cmd+\on macOS orCtrl+\on Windows and Linux). - Toggle preview (
Shift+Cmd+Von macOS orShift+Ctrl+Von Windows and Linux). - Press
Ctrl+Space(Windows, Linux, macOS) to see a list of Markdown snippets.
Enjoy!