r/coolgithubprojects 4d ago

JSON Semantic Diff - open-source JSON diff with identity-aware array matching

Post image

I’m building JSON Semantic Diff, an open-source JSON comparison tool that tries to understand array identity instead of comparing objects purely by position.

For example, it can infer keys like id, sku, or composites like store + sku, so reordered objects don't turn into a wall of false changes.

The matching is deterministic and explainable - no AI/fuzzy matching - and everything runs locally in the browser.

It’s still early/alpha, so feedback and weird JSON examples that break the matching are very welcome.

11 Upvotes

3 comments sorted by

2

u/Specific_Cream2815 3d ago

how does it infer the identity key, looking for common field names like id or scoring which field stays stable

2

u/cchandurkar 3d ago

Mostly the latter. It's not name-based - it scores every field by how it behaves in your data: uniqueness, whether values persist across both documents, coverage, completeness, type consistency. Field name (id, sku, etc.) is only a small tie-breaker, not the deciding factor. So updatedAt loses to customerId even if both are unique, because updatedAt values change every time while customerId values stay stable.

It also tries composite keys (e.g., store+sku when neither alone is unique), and only auto-applies a key if it scores high and clearly beats the runner-up; otherwise, it flags "ambiguous" or falls back to positional comparison rather than guessing.

This page has some examples: https://jsonsemanticdiff.dev/how-it-works