Skip to content
| Marketplace
Sign in
Visual Studio Code>Formatters>XYJson - XML YAML JSON ConverterNew to Visual Studio Code? Get it now.
XYJson - XML YAML JSON Converter

XYJson - XML YAML JSON Converter

Ryo Hasegawa

|
105 installs
| (1) | Free
Convert between XML, YAML, and JSON. Pretty-print or minify your data. Supports converting selected text only.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

XYJson — XML · YAML · JSON Converter

Working with API responses, config files, or legacy XML? Convert between formats and pretty-print or minify your data in seconds — without leaving VS Code.

  • Convert XML ↔ YAML ↔ JSON, or format (pretty-print / minify) in place
  • Paste from clipboard — convert clipboard content directly, no need to open a file first
  • Works on a selection or the entire document
  • Automatic input format detection — no need to specify the source format
  • Available from Command Palette and editor right-click menu

Demo

XYJson demo

Features

  • Conversion commands — open the result in a new tab or beside the current editor, leaving the original untouched:
    • XYJson: Convert to JSON — from XML or YAML
    • XYJson: Convert to XML — from JSON or YAML
    • XYJson: Convert to YAML — from JSON or XML
  • Format commands — reformat the current document in place:
    • XYJson: Format JSON
    • XYJson: Format XML
    • XYJson: Format YAML
  • Clipboard commands — read from clipboard and open the result in a new tab or beside the current editor:
    • XYJson: Paste Clipboard as JSON
    • XYJson: Paste Clipboard as XML
    • XYJson: Paste Clipboard as YAML
  • Works on the entire document, or just the selected text if a selection is active
  • Output format (pretty / minified) selected via Quick Pick on each command, or fixed via xyjson.outputStyle setting
  • Automatic input format detection:
    • Content starting with < → parsed as XML
    • Content starting with { or [ → parsed as JSON (falls back to YAML for YAML flow style)
    • Everything else → parsed as YAML

Usage

Convert an open file

  1. Open an XML, JSON, or YAML file

  2. Optionally, select a portion of text to convert only that range

  3. Open the Command Palette (Ctrl+Shift+P / Cmd+Shift+P) or right-click in the editor

  4. Select a command:

    • XYJson: Convert to JSON / XML / YAML — opens the result in a new tab or beside the current editor
    • XYJson: Format JSON / XML / YAML — reformats in place (shown only for matching file type)
  5. Choose the output style in the Quick Pick:

    • Pretty — indented with newlines
    • Minified — single line, no whitespace

    Tip: To skip the Quick Pick entirely, set xyjson.outputStyle to "pretty" or "minified" in your settings. This is useful when you always use the same style or want to bind a command to a keyboard shortcut.

Paste from clipboard

  1. Copy any XML, JSON, or YAML content to your clipboard
  2. Open the Command Palette (Ctrl+Shift+P / Cmd+Shift+P)
  3. Run XYJson: Paste Clipboard as JSON / XML / YAML
  4. The converted result opens in a new tab or beside the current editor — no need to open a file first

Settings

Setting Type Default Description
xyjson.outputStyle string ask Output style for all commands. ask shows a Quick Pick each time; pretty or minified skips the prompt.
xyjson.convertOutput string newTab Where to display the result of convert commands. newTab opens a new tab; beside opens beside the current editor.
xyjson.indentSize integer 2 Number of spaces used for indentation when pretty-formatting XML/YAML/JSON output. Min: 1, Max: 8.
xyjson.xmlAttributeNamePrefix string @_ Prefix added to XML attribute names when parsing or building XML.

License

MIT

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