I would like to have a GET controller action that returns a JSON serialization dictionary. The key to the dictionary is a simple class with two primitives as properties - let's call it ClassOne. However, when I try to use JSON in the dictionary, I get the following error:
System.Collections.Generic.Dictionary`2[[ClassOne],[ClassTwo]]' is not supported for serialization/deserialization of a dictionary, keys must be strings or objects.
The phrase "keys must be strings or objects" implies that it is possible to serialize a dictionary that contains objects as its keys. However, I cannot find a way to do this. What are my options in this situation?
source share