Skip to content
| Marketplace
Sign in
Visual Studio Code>Formatters>Json ReplacerNew to Visual Studio Code? Get it now.
Json Replacer

Json Replacer

stangray

|
4 installs
| (0) | Free
Strip escape characters
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

JSON Replacer

Clean up escape characters and auto-format mixed JSON/XML content with a single right-click.

Features

Right-click in the editor to open the Json Replacer submenu with two commands:

AutoReplace — Strip escape characters

Remove unnecessary escape sequences from text. Works with JSON, XML, TXT, and other plain text formats:

Before After
\r\n (removed)
\" "
{\"CityCode\":\"SHA\"} {"CityCode":"SHA"}
<POS><Source CityCode=\"SHA\" /></POS> <POS><Source CityCode="SHA" /></POS>

AutoFormat — Smart formatting for mixed JSON/XML

Parses the document and automatically formats JSON structure and embedded XML content:

  • Outer JSON — pretty-printed with indentation
  • Embedded JSON strings — promoted to real nested objects
  • Embedded XML strings — formatted with proper indentation
  • Text content — preserved with readable line breaks

Before

RSP: {"errcode":0,"data":"data...","debugs":["{\"Pos\":[{\"CityCode\":\"SHA\"}]}", ": <RQ><POS><Source CityCode=\"SHA\" /></POS></RQ>"]}

After

RSP:
{
  "errcode": 0,
  "data": """data...""",
  "debugs": [
    {
      "Pos": [
        {
          "CityCode": "SHA"
        }
      ]
    },
    """<RQ>
  <POS>
    <Source CityCode="SHA" />
  </POS>
</RQ>"""
  ]
}

Usage

  1. Open a file in the editor.
  2. Right-click → Json Replacer submenu:
    • AutoReplace — strip \r\n and \" escape characters
    • AutoFormat — format JSON structure with embedded XML/JSON content

Requirements

  • VS Code >= 1.75.0

Changelog

0.0.8 (2026-05-20)

  • AutoFormat — new command for smart formatting of mixed JSON/XML content
    • Outer JSON pretty-printed with indentation
    • Embedded JSON strings promoted to real nested objects (no more \" escaping)
    • Embedded XML strings formatted with proper indentation (supports text prefixes)
    • Multi-line text content displayed with """ delimiters for readability
    • Selection support: format only selected text, or entire document if no selection
    • Block scanning: works in .http / .rest files with multiple JSON blocks
  • Submenu — right-click context menu restructured into Json Replacer submenu with:
    • AutoReplace — existing escape-stripping logic
    • AutoFormat — new smart formatting
  • Semantic Tokens — mixed syntax highlighting for JSON / XML / HTTP content
    • JSON: keys, strings, numbers, booleans, null, structural chars
    • XML: tag names, attribute names, attribute values
    • HTTP: methods (POST/GET...), headers, comments (#), variables (@var, {{var}})
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft