kako-jun
diffx
Rust

Semantic diff for structured data (JSON, YAML, TOML, XML, INI, CSV) — compares meaning, not text

Last updated Jun 2, 2026
85
Stars
4
Forks
0
Issues
0
Stars/day
Attention Score
33
Language breakdown
No language data available.
Files click to expand
README

diffx

日本語

CI Crates.io docs.rs License: MIT

Semantic diff tool for structured data (JSON/YAML/TOML/XML/INI/CSV). Ignores key ordering and whitespace, shows only meaningful changes.

Why diffx?

Traditional diff doesn't understand structure:

$ diff configv1.json configv2.json
< {
<   "name": "myapp",
<   "version": "1.0"
< }
> {
>   "version": "1.1",
>   "name": "myapp"
> }

A simple key reordering shows every line as changed.

diffx shows only semantic changes:

$ diffx configv1.json configv2.json
~ version: "1.0" -> "1.1"

Installation

# As CLI tool
cargo install diffx

As library (Cargo.toml)

[dependencies] diffx-core = "0.6"

Usage

# Basic
diffx file1.json file2.json

Output example

~ version: "1.0" -> "1.1"
  • features[0]: "new-feature"
  • deprecated: "old-value"

Supported Formats

JSON, YAML, TOML, XML, INI, CSV (auto-detected by extension, use --format to override)

Main Options

--output json|yaml       # Machine-readable output
--quiet                  # Return only exit code (0: same, 1: diff found)
--ignore-keys-regex RE   # Ignore keys matching regex
--array-id-key KEY       # Identify array elements by KEY for comparison
--epsilon N              # Float comparison tolerance
--ignore-case            # Case-insensitive comparison
--ignore-whitespace      # Ignore whitespace differences
-r, --recursive          # Recursive directory comparison

Output Symbols

  • + Added
  • - Removed
  • ~ Modified
  • ! Type changed

CI/CD Usage

# Detect config changes
if ! diffx config/prod.json config/staging.json --quiet; then
  echo "Config has changed"
  diffx config/prod.json config/staging.json --output json > changes.json
fi

Compare ignoring timestamps and metadata

diffx apiv1.json apiv2.json --ignore-keys-regex "^(timestamp|updated_at)$"

Examples

See diffx-cli/tests/cmd/ for executable examples:

Documentation

License

MIT

🔗 More in this category

© 2026 GitRepoTrend · kako-jun/diffx · Updated daily from GitHub