Reputation: 33411
I need to generate a 'string' key based on the state of an object. I thought of serializing the object to JSON and use the result as key. This only works if JSON.Net always serializes the same way.
Is JSON.Net guaranteed to serialize the same way on the same machine if an object of the same class with the same state if encountered?
Upvotes: 3
Views: 227
Reputation: 49052
Yes, otherwise the unit tests would fail.
There is an Order property on JsonPropertyAttribute if you want to explicitly state the order.
Upvotes: 4