ljlljl0
V2EX  ›  问与答

json diff 有支持同时多个 json 文件对比的吗

  •  
  •   ljlljl0 · Nov 21, 2024 · 1708 views
    This topic created in 735 days ago, the information mentioned may be changed or developed.
    请问 json diff 网上都是 2 个文件对比,我想核对多套服务器配置,服务器配置已经通过 json 抓取到了,现在就差对比 json 间的差异,请问怎么同时 diff 呢,以及有没有现成的工具呀,谢谢大佬。
    CEBBCAT
    CEBBCAT
    Nov 21, 2024
    1
    可以参考 https://github.com/afnanenayet/diffsitter 项目

    另外,我是 jq -S 后对比的,效果也不错,如果你没有用过 jq ,-S 这个参数是用来把 JSON 按 key 重排序的。或者使用在线工具 https://codeshack.io/json-sorter/

    另附对比工具 https://www.diffchecker.com/
    ljlljl0
    ljlljl0
    OP
    Nov 21, 2024
    2
    @CEBBCAT 看起来也是 2 个文件对比
    CEBBCAT
    CEBBCAT
    Nov 21, 2024
    3
    @ljlljl0 #2 你是想要*多个*文件对比吗?那你这个问题 Google 一下就有
    ljlljl0
    ljlljl0
    OP
    Nov 21, 2024
    4
    @CEBBCAT 我对比的是 json 文件,不是单存内容对比。json 格式内容一对一对比网上现成的都是 2 个,我目前也是写的两个对比用,想看看有没有更好的办法。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1437 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 36ms · UTC 16:46 · PVG 00:46 · LAX 08:46 · JFK 11:46
    ♥ Do have faith in what you're doing.