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
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
Open an XML, JSON, or YAML file
Optionally, select a portion of text to convert only that range
Open the Command Palette (Ctrl+Shift+P / Cmd+Shift+P) or right-click in the editor
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)
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
Copy any XML, JSON, or YAML content to your clipboard
Open the Command Palette (Ctrl+Shift+P / Cmd+Shift+P)
Run XYJson: Paste Clipboard as JSON / XML / YAML
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.