DEV Community

Daniel Jonathan
Daniel Jonathan

Posted on

Unified XJPath (Dansharp) Viewer

Unified XJPath (Dansharp) Viewer

I often work with XML and JSON payloads while building and debugging integrations.

Unified XJPath Viewer came out of that need — to quickly explore, inspect, and query both formats without switching tools.

Working with XML and JSON files usually means switching between tools or guessing query paths.

Unified XJPath Viewer makes it easy — a single VS Code extension for exploring and querying both XML and JSON files.


What It Does

  • Shows a live tree view of your XML or JSON document
  • Lets you run XPath or JSONPath queries directly
  • Syncs between the viewer and the editor
  • Lets you copy paths or values with one click
  • Automatically detects the file type and refreshes when you edit

How to Use

  1. Install the VS Code extension and then open any XML or JSON/JSONC file in VS Code
  2. Run UnifiedXJPath: Open Query Viewer from the Command Palette
  3. Click on any node in the tree to see its path and value
  4. Type an XPath or JSONPath query and press Enter to evaluate

The results are shown instantly — click any result to jump to it in the editor.


Commands

You can access all commands from the VS Code Command Palette (Ctrl+Shift+P):

Image description1

Command Description
UnifiedXJPath: Open Query Viewer Opens the main viewer beside your editor.
UnifiedXJPath: Evaluate Query Lets you type an XPath or JSONPath expression and view matching results.
UnifiedXJPath: Copy Path Copies the absolute path of the current node under your cursor.
UnifiedXJPath: Format Document Formats the XML or JSON file using VS Code’s formatter.
UnifiedXJPath: Manage Namespaces Opens a small UI to manage XPath namespace prefixes.

Example

Here’s how it looks when exploring an XML document:

Image description2

On the left, you see your XML file open in VS Code.

On the right, the UnifiedXJPath Viewer displays a live tree of the same document.

You can:

  • Expand or collapse nodes
  • See values and attributes
  • Copy the full XPath
  • Reveal the selected node in the editor
  • Use the search bar above the tree to quickly find nodes by tag name or value

When you click on a node in the tree (XML or JSON), the viewer instantly shows the absolute path and value of that node in the Inspector panel below the tree.

For XML, the path appears as an XPath (e.g. /ns0:ShipmentConfirmation[1]/ns0:Reference[1]),

and for JSON it appears as a JSONPath (e.g. $.ShipmentConfirmation.Reference).

This makes it easy to copy or reuse the exact query path in your code or transformations.

In this example, the query /ns0:ShipmentConfirmation/ns0:Reference finds one matching node.

The viewer shows its full XPath, value, and lets you copy or reveal it directly in the editor.

Image description3


Settings

You can tweak a few options under the unifiedQuery section:

Setting Default Description
unifiedQuery.outputLimit 200 Maximum number of characters shown in previews.
unifiedQuery.compactPaths false Hides [1] from single-instance paths.
unifiedQuery.namespaces {} Custom namespace prefixes for XPath evaluation.

Credits

Inspired by Dansharp XML Viewer by Pronert Daniel — this extension builds on that great idea.


👉 Install Unified XJPath Viewer from the VS Code Marketplace

Unified XJPath Dansharp Viewer — one simple place to explore and query XML and JSON in VS Code.

Top comments (0)