A JavaScript library to compute and apply diffs (deltas) between JSON objects, with support for arrays, text, and multiple output formats.
jsondiffpatch is a JavaScript library that computes and applies differences (deltas) between JSON objects. It solves the problem of efficiently detecting changes in complex nested data structures, enabling features like undo/redo, state synchronization, and real-time collaboration.
JavaScript developers building applications that require change tracking, such as collaborative editing tools, state management systems, or data versioning solutions.
Developers choose jsondiffpatch for its accurate deep diffing, smart array handling, multiple output formats, and extensible plugin system, making it a versatile solution for object comparison and patching.
Diff & patch JavaScript objects
Uses Longest Common Subsequence for intelligent array comparisons and handles nested objects, ensuring precise change detection in complex data structures.
Supports JSON delta, visual HTML, annotated JSON, JSON Patch RFC 6902, and console output, providing flexibility for debugging, visualization, and API compatibility.
Can reverse deltas for undo functionality and unpatch objects to revert changes, essential for state management and collaborative editing features.
Built on a pipes and filters pattern, allowing custom plugins and formatters for tailored diffing logic, as detailed in the plugins documentation.
Intelligent array diffing requires providing an objectHash function; without it, matching defaults to position-based, which can lead to incorrect diffs.
Deep diffing and LCS algorithms can be slow with very large or deeply nested objects, impacting real-time applications, as acknowledged in the need for property filters.
Text diffing relies on google-diff-match-patch, which must be imported separately, adding setup complexity and increasing bundle size.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.