RJD - Rust JSON Diff
Compare JSON files or strings and output the differences. Works as a CLI tool or Rust library.
Installation
CLI:
Library:
[]
= "1.2"
CLI Usage
Options
--format <FORMAT>- Output format:changes(default),rfc6902,after--sort, -s- Sort keys alphabetically--stdin- Read second input from stdin--ignore-json <FILE>- JSON file with paths to ignore (can be used multiple times)--max-file-size <SIZE>- Max file size in bytes (default: 100MB)--max-depth <DEPTH>- Max JSON nesting depth (default: 1000)--follow-symlinks- Follow symbolic links (default: reject for security)
Environment Variables
RJD_MAX_FILE_SIZE- Default max file sizeRJD_MAX_JSON_DEPTH- Default max depthRJD_FOLLOW_SYMLINKS- Set to1to follow symlinks by default
Library Usage
use ;
use json;
Loading Files
use ;
let old = load_json_file?;
let new = load_json_file?;
let changes = diff;
Output Formats
use create_formatter;
let formatter = create_formatter?;
let output = formatter.format?;
Filtering Changes
// Zero-copy filtering for large diffs
let patterns = vec!;
let filtered: = changes
.iter_filtered_changes
.collect;
Custom Config
use ;
let config = LoadConfig ;
let json = load_json_file_with_config?;
Output Formats
Changes format (default):
RFC 6902 format:
After format (final state):
API
Types: Change, Changes, JsonPath, RjdError, LoadConfig, SymlinkPolicy
Functions: diff(), load_json_file(), load_json_input(), create_formatter(), load_ignore_patterns()
All functions return Result<T, RjdError>.
Full docs: docs.rs/rjd
License
MIT OR Apache-2.0