Newtonsoft JsonConverter to replicate the serialization of the JsonObjectAttribute on an IEnumerable
Can someone help me create a Newtonsoft.Json.JsonConverter that will write an IEnumerable the same way one is written if the class has the JsonObjectAttribute?
For example, given this class:
I need the result from this:
To look like this:
Doing the above works fine if the class has the JsonObjectAttribute on it like this:
However without the JsonOjectAttribute the result will look like this:
But I cannot use the attribute since I do not own the class I am trying to serialize in this way, Thus I need to write a converter to do this same thing but I am struggling to figure out how.
I tried googling this but I could not find any similar examples and everyone just seems to suggest using the JsonObject attribute, which I can't and do not want to use.
Any assistance would be appreciated.
For example, given this class:
I need the result from this:
To look like this:
Doing the above works fine if the class has the JsonObjectAttribute on it like this:
However without the JsonOjectAttribute the result will look like this:
But I cannot use the attribute since I do not own the class I am trying to serialize in this way, Thus I need to write a converter to do this same thing but I am struggling to figure out how.
I tried googling this but I could not find any similar examples and everyone just seems to suggest using the JsonObject attribute, which I can't and do not want to use.
Any assistance would be appreciated.