Open bes opened 5 years ago
It can be done easily, just enable this option to outside: https://developer.apple.com/documentation/foundation/jsonserialization/writingoptions/2888322-sortedkeys
I had to change the ObjecMapper source code to enable this option because hashing a json would never return the same value.
I would like to propose a feature that would help a lot when debugging using printing to log.
For a given Mappable, it would be nice if the
toJSONString(prettyPrint: true)
could get a new propertydeterministic: Bool
, that way every time you print a Mappable you can be confident that all properties are printed in the same order.The easiest way would just be to sort the keys alphabetically, for every Mappable and sub Mappable.
Thank you for considering my feature request.