That could work, but note that there are other libraries that are purpose-built to do diffing without the rest of git's many features. We are using jsondiffpatch [1] and quite happy with it. It also has builtin formatters to output e.g. html view of the changes.
[1] : https://github.com/benjamine/jsondiffpatch/blob/master/READM...