If you have your expected json result, you can just use library LateApexEarlySpeed.Xunit.Assertion.Json to do "json-level" assertion (yes, it considers "varying data structure of the JSON")
JsonAssertion.Equivalent("""
{
"a": 1,
"b": 2
}
""",
"""
{
"b": 2,
"a": 1
}
""");
(I am author of this library)