I'm deserialisizing JSON using Json.NET in C++/CLI.
Let's say I have the following string:
{
"StrProp": ["str1", "str2"],
"Flt": 42.2
}
I would like to get a Dictionary<String^, Object^>^
out of this.
First thing to try then is DeserializeObject:
Dictionary<String^, Object^>^ dict = Json::JsonConvert::DeserializeObject<Dictionary<String^, Object^>^>(json);
However, I find that dict["StrProp"]
is a JArray, when I would like it to be Collection type (like array<String^>^
).
I realise I can create a JsonConverter
of some sort but I'm struggling a bit on how to ensure that instead of parsing a string and returning a JArray, it needs to return a Collection type (like array<>) rather than a specific Json.NET type.
Anyone?