npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

virtual-react-json-diff

v1.0.16

Published

Fast, virtualized React component for visually comparing large JSON objects. Includes search, theming, and minimap.

Readme

virtual-react-json-diff

NPM version Downloads bundle size BuyMeACoffee

👉 Try it now

A high-performance React JSON diff viewer for large, real-world JSON data.

Built to handle tens of thousands of lines without freezing the UI, it uses virtualized rendering to stay fast and responsive even in production-scale scenarios.

Powered by json-diff-kit, it supports virtual scrolling, advanced comparison options, search, dual minimaps, and customizable theming.

Why virtual-react-json-diff exists

Most JSON diff viewers work well for small examples, but start breaking down in real-world scenarios:

  • Large JSON files cause the UI to freeze or crash
  • Rendering thousands of DOM nodes makes scrolling unusable
  • Array changes are hard to reason about without object-level comparison
  • It’s difficult to understand the impact of changes beyond raw diffs

virtual-react-json-diff was built to solve these problems.

It is designed for internal dashboards and developer tools that need to compare large, deeply nested JSON objects efficiently and interactively.

Key Features

virtual-react-json-diff is designed for scenarios where traditional diff viewers become unusable due to size or complexity.

Built for Large JSONs

  • Virtualized rendering powered by react-window
  • Smooth scrolling and interaction even with very large diffs

Navigate Complex Changes

  • Dual minimap with visual change indicators
  • Jump directly to changes using search highlighting
  • Optional single minimap for compact layouts

Understand Change Impact

  • Line count statistics for added, removed, and modified lines
  • Object-level statistics when using compare-key array diffs
  • Quickly assess how big or risky a change really is

Advanced Comparison Control

  • Ignore specific keys or paths anywhere in the JSON tree
  • Multiple comparison strategies (strict, loose, type-aware)
  • Fine-grained control over how values are considered equal

Customizable & Extensible

  • Custom class names for theming
  • Inline diff customization
  • Access raw diff data for advanced use cases

Demo

👉 Try it now - Interactive demo with live examples

Example Screenshot

Installation

npm install virtual-react-json-diff
# or
yarn add virtual-react-json-diff
# or
pnpm add virtual-react-json-diff

Usage

import { VirtualDiffViewer } from "virtual-react-json-diff";

const oldData = { name: "Alice", age: 25 };
const newData = { name: "Alice", age: 26, city: "NYC" };

export default function App() {
  return (
    <VirtualDiffViewer
      oldValue={oldData}
      newValue={newData}
      height={600}
      showLineCount={true}
      showObjectCountStats={false}
    />
  );
}

Understanding Diff Configuration

The viewer exposes two different configuration layers, each serving a distinct purpose.

Quick Mental Model

  • differOptions → Controls how the diff is generated
  • comparisonOptions → Controls what is compared and how values are matched

differOptionsHow the diff works

These options are passed directly to the underlying diff engine.

Use them to:

  • Choose how arrays are compared (compare-key, positional, etc.)
  • Define comparison keys for object arrays
  • Control depth, circular detection, and modification behavior
differOptions={{
  arrayDiffMethod: "compare-key",
  compareKey: "id",
  maxDepth: 999
}}

comparisonOptionsWhat is considered equal or ignored

These options affect comparison behavior without changing the diff structure.

Use them to:

  • Ignore volatile fields (timestamps, metadata)
  • Exclude specific paths
  • Compare values across types
comparisonOptions={{
  ignoreKeys: ["updatedAt", "__typename"],
  ignorePaths: ["meta.timestamp"],
  compareStrategy: "type-aware"
}}

Using Both Together

<VirtualDiffViewer
  oldValue={oldData}
  newValue={newData}
  differOptions={{
    arrayDiffMethod: "compare-key",
    compareKey: "id"
  }}
  comparisonOptions={{
    ignoreKeys: ["updatedAt"],
    compareStrategy: "type-aware"
  }}
/>

This separation keeps the diff engine flexible while allowing precise control over comparison behavior.

Props

Required

| Prop | Type | Description | | ---------- | -------- | --------------------------------- | | oldValue | object | Original JSON object (left side). | | newValue | object | Updated JSON object (right side). |


Layout & Display

| Prop | Type | Default | Description | | ------------ | -------- | ------- | ----------------------------------------------- | | height | number | — | Height of the diff viewer in pixels. | | leftTitle | string | — | Optional title shown above the left panel. | | rightTitle | string | — | Optional title shown above the right panel. | | className | string | — | Custom CSS class applied to the root container. |


Search & Navigation

| Prop | Type | Default | Description | | ------------------- | ------------------------- | ------- | ----------------------------------------------- | | hideSearch | boolean | false | Hides the search bar when set to true. | | searchTerm | string | "" | Initial search term to highlight in the diff. | | onSearchMatch | (index: number) => void | — | Callback fired when a search match is found. | | showSingleMinimap | boolean | false | Show a single minimap instead of dual minimaps. | | miniMapWidth | number | 40 | Width of each minimap in pixels. |


Statistics & Insights

| Prop | Type | Default | Description | | ---------------------- | --------- | ------- | -------------------------------------------------------------------- | | showLineCount | boolean | false | Display added, removed, and modified line counts. | | showObjectCountStats | boolean | false | Display object-level stats (requires compare-key array diffing). |

Note: showObjectCountStats only works when differOptions.arrayDiffMethod = "compare-key" and compareKey is provided.


Diff Configuration

| Prop | Type | Default | Description | | ------------------- | ----------------------- | ------------------ | ------------------------------------------------------------- | | differOptions | DifferOptions | Engine defaults | Controls how the diff is generated (arrays, depth, keys). | | comparisonOptions | DiffComparisonOptions | — | Controls what is compared and how values match. | | inlineDiffOptions | InlineDiffOptions | { mode: "char" } | Fine-tune inline diff rendering behavior. |


Advanced & Utility

| Prop | Type | Default | Description | | ------------- | -------------------------------------------------- | ------- | ----------------------------------------------------------- | | getDiffData | (diffData: [DiffResult[], DiffResult[]]) => void | — | Access raw diff results for custom processing or analytics. |

Styling

The component exposes a root container with class diff-viewer-container. You can pass your own class name via the className prop to apply custom themes.

🙌 Acknowledgements

Built on top of the awesome json-diff-kit.

License

MIT © Utku Akyüz

Contributing

Pull requests, suggestions, and issues are welcome!