Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I'm probably missing something obvious, but diff seems to be handling this just fine?

    # diff -u <(echo '[{"a": "b"}, {"c": "d"}, {"e": "f"}]' | jq) <(echo '[{"a": "b"}, {"e": "f"}]' | jq)
    --- /dev/fd/63 2024-09-09 16:31:23.376841575 +0200
    +++ /dev/fd/62 2024-09-09 16:31:23.376841575 +0200
    @@ -3,9 +3,6 @@
       "a": "b"
       },
       {
    -    "c": "d"
    -  },
    -  {
         "e": "f"
       }
     ]


Yeah that works. But I also wanted the ability to produce JSON Patch and JSON Merge Patch formats. And to support set semantics, identifying objects by specified keys. And it works on YAML too.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: