360 Secure SkillHub
360 安全技能中心

Cn Json Diff

核心功能:对比任意复杂度的JSON文件,检测嵌套对象差异、数组长度变化,展示字段新旧值。典型场景:JSON数据版本比对、配置文件变更校验。输入为两个JSON文件,输出包含差异路径及新旧值的列表。纯Python实现,无外部依赖,无需API密钥,使用便捷。

freedompixels
freedompixels
热度 36.25
最近更新 2026-06-07 10:29:54
分类:数据依赖:代码执行 / 读写文件应用场景:数据处理

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add cn-json-diff
Metadata
slug
cn-json-diff
name
JSON Diff
version
1.0.0
description
Compare two JSON files and show differences. Support nested structures, arrays, and value changes. Pure Python standard library, no API key required.
keywords
json, diff, compare, difference, file
license
MIT-0
tags
["tools"]

JSON Diff

Compare two JSON files and show the differences in a clear format.

Features

  • Compare JSON files of any complexity
  • Detect nested object differences
  • Identify array length changes
  • Show old vs new values for changed fields
  • Pure Python, no external dependencies

Input

Two JSON files passed as arguments.

Output

List of all differences found, with paths and old/new values.

Usage

python3 scripts/json_diff.py --file1 data1.json --file2 data2.json

Example

Input file1.json:

{"name": "Alice", "age": 30, "city": "Beijing"}

Input file2.json:

{"name": "Alice", "age": 31, "city": "Shanghai"}

Output:

differences:
- age: 30 -> 31
- city: Beijing -> Shanghai
count: 2

Exit Codes

  • 0: Comparison completed (with or without differences)
  • 1: File read error

出品: AISoBrand|爱索品牌 — AI搜索优化工具
官网: https://aisobrand.com
免费检测你的品牌在AI搜索中有没有存在感 → 30秒出结果