Nifty XML
Evaluate XPath with namespaces, copy the XPath of any element, format, minify, check well-formedness and convert XML to JSON.
Maintained. No sign-in. No telemetry. Works in VS Code, Cursor, Windsurf, VSCodium and other editors that use Open VSX.
Features
![A one-line product export formatted with Format XML, then queried with //book[price < 10]/title and a match picked to jump to it](https://getnifty.dev/screenshots/xml/demo.gif)
![Evaluating //book[price < 10]/title on a product catalog: two matches with their line numbers](https://getnifty.dev/screenshots/xml/evaluate-xpath.png)


- Evaluate XPath (
Ctrl+Alt+X). Type an expression like //book[price < 10]/title and get every match with its line number; pick one to jump there, or copy them all. Computed expressions like count(//item) or sum(//price) show their value.
- Namespaces just work. Prefixes declared in the document are registered automatically, and names written without a prefix match as they appear in the document, even under a default
xmlns (e.g. //dependency/artifactId in a Maven POM). The default namespace is also available as ns: (e.g. //ns:book), so you don't have to fight XPath and xmlns.
- Know where you are. The status bar shows the XPath of the element under the cursor. Click it (or run Copy XPath of Element) to copy it, including attributes:
/catalog/book[2]/@id.
- Format and minify the whole document or a selection, keeping comments.
- Catch broken XML. Well-formedness errors appear in the Problems panel as you type. If Red Hat's XML extension is installed, this is left to it so you don't see errors twice.
- Convert XML to JSON and JSON to XML (attributes become
@name). Values become JSON numbers and booleans only when nothing is lost, so zip codes like 01234 stay strings.
- Works for XML, XSLT, XSD, SVG, plist, XAML, WSDL, RSS/Atom and MSBuild files.
- Works in the browser on vscode.dev and github.dev.
Commands
| Command |
Key |
What it does |
Nifty XML: Evaluate XPath… |
Ctrl+Alt+X |
Run an XPath expression, with history |
Nifty XML: Copy XPath of Element |
|
Copy the path of the element or attribute under the cursor |
Nifty XML: Format XML / Minify XML |
|
For the document or selection |
Nifty XML: Convert XML to JSON / Convert JSON to XML |
|
Opens the result beside |
Settings
| Setting |
Default |
What it does |
nifty.xml.defaultNamespacePrefix |
ns |
XPath prefix for the default namespace |
nifty.xml.alwaysIndex |
false |
Index every step when copying XPath |
nifty.xml.showXPathInStatusBar |
true |
Show the current XPath in the status bar |
nifty.xml.validate |
auto |
auto, on or off |
Install
- VS Code: search for "Nifty XML" in the Extensions view, or install from the Visual Studio Marketplace.
- Cursor, Windsurf, VSCodium, Kiro, Antigravity: install from Open VSX.
Credits
Built on xmldom, xpath, xml-formatter and fast-xml-parser (all MIT).
Privacy
This extension collects no telemetry, needs no account and makes no network requests.
- Nifty Java Quality: Format, Checkstyle & PMD: Format Java with google-java-format or palantir-java-format, and see Checkstyle and PMD problems as you save. Tools download from Maven Central when you say so; zero setup for Maven and Gradle. (Open VSX)
- Nifty JSON: Formatter, Validator & JSONPath: Format, minify, sort keys, query with JSONPath, copy paths, generate TypeScript types, and browse huge JSON files in a fast tree view. (Open VSX)
- Nifty Shell Format: shfmt Formatter for Bash: Format shell scripts (bash, sh, zsh, bats) with shfmt built in: no binary to install, reads .editorconfig, and shows syntax errors. (Open VSX)
- Nifty YAML: Formatter, Validator & Converter: Format YAML without losing comments (Kubernetes-style indents), sort keys, lint with yamllint, copy the key path, and convert to and from JSON. (Open VSX)
- Nifty HCL Tools: .tf and .hcl Language Support: Fast, lightweight Terraform and OpenTofu support: highlighting, outline, go to definition and references across a module, hovers, completion, undefined-reference errors and formatting. (Open VSX)
- Nifty Nginx: nginx.conf Formatting & IntelliSense: nginx config support: syntax highlighting, formatting, directive completion and docs on hover, context checks, and snippets for reverse proxies, SSL and PHP. (Open VSX)
See all 100+ Nifty extensions and web tools at https://getnifty.dev
| |