I am trying to compare two JSON Strings for equality. I found this solution which uses Jackson as shown below but in all my project I am using GSON so I need to do the same
I don't believe that Gson library makes any statements that the JSON output from two equal JSON elements will be the same, mostly due to the order of properties in objects, since the standard doesn't require any kind of order. Gson library itself doesn't offer a functionality to compare JSON elements or serialized representation thereof. One can write a function that will compare two JSON elements and properly descend into the underlying compound structures (i.e. arrays and objects).
I was able to find this article here that seems to contain a working comparison function.