render JSON differences with custom your styles
npm install diff-viz![ts][ts-badge]
![version][version-badge]
[![download-badge]][download-link]
![license][license-badge]
![test][test-badge]
![coverage][coverage-badge]

render JSON differences and custom your styles
two choices:
``bashreact component, easy to start
npm install react-diff-viz
https://littlewhite-hai.github.io/diff-viz/
!demo
- ๐ Precise diff detection between complex JSON objects
- โก Efficient array alignment using LCS (Longest Common Subsequence) algorithm
- ๐ Support for nested arrays and objects with any level of complexity
- ๐จ Customizable styling of diff results
- ๐งช Well-tested with comprehensive test cases
The library is thoroughly tested to ensure reliability and correctness:
| File | % Statements | % Branches | % Functions | % Lines |
| ----------------- | ------------ | ---------- | ----------- | ------- |
| diff-algorithm.ts | 97.24% | 94.19% | 100% | 97.24% |
We test various scenarios to ensure robust diff detection:
- โ
Simple object differences
- โ
Nested object structures
- โ
Array handling with different alignment strategies
- โ
Multi-dimensional arrays
- โ
Special value comparisons (null, undefined, dates)
- โ
Custom equality functions
- โ
Data2-based array alignment (preserving second array structure)
[ts-badge]: https://badgen.net/badge/-/TypeScript/blue?icon=typescript&label
[download-badge]: https://img.shields.io/npm/dm/diff-viz
[download-link]: https://www.npmjs.com/package/diff-viz
[version-badge]: https://img.shields.io/npm/v/diff-viz
[license-badge]: https://img.shields.io/github/license/Milkdown/milkdown
[test-badge]: https://img.shields.io/badge/tests-65%20passed-brightgreen
[coverage-badge]: https://img.shields.io/badge/coverage-94%25%20branches-brightgreen