XML has a complex solution for this, canonicalization[1], to enable signed XMLs[2]. Seems some folks are trying the same with JSON[3].
[1]: https://en.wikipedia.org/wiki/Canonical_XML
[2]: https://en.wikipedia.org/wiki/XML_Signature
[3]: https://www.rfc-editor.org/rfc/rfc8785