Closed akhansari closed 3 years ago
The output should be a JSON object in both cases. The only difference is the order of the keys: Map
is sorted by comparing the keys, whereas Dictionary
is sorted in an arbitrary order that is based on its internal implementation.
JsonSerializer.Serialize(Map ["b", 1; "a", 2], options) // --> {"a":2,"b":1}
JsonSerializer.Serialize(dict ["b", 1; "a", 2], options) // --> {"b":1,"a":2}
Is this what you mean? Or do you have other differences?
I wonder why they haven't the same output. Just curious what's the reason behind this?
Is there any possibility to have the same, Map like Dictionary?