Search code examples
pythonjsonpython-3.xdjangodiff

How to compare different JSON output like Git's compare diff feature


I want to compare two different JSON results after I changed my code. Regardless of what was changed in the code, I want to show the outputted difference like the 'compare diff' feature in Git.

How can I do this? I use Python 3 and Django's REST framework.


Solution

  • Check out diff-match-patch

    It will show the changes with red (old) and green (new) text.