Using Newtonsoft.Json how do I convert a JSON object into a dictionary with Path being the key?
IDictionary<string, object> FlattenJson(string Json)
{
JToken Input = JToken.Parse(Json);
... magic ...
return Result;
}
Key of the dictionary shall be the JToken.Path value and Value of the dictionary shall be the actual value in its "native" format (string as string, integer a long, etc).
"message.body.titles[0].formats[0].images[0].uri" => "I/41SKCXdML._SX160_SY120_.jpg" "message.body.titles[0].formats[0].images[0].widthPx" => 0 "message.body.titles[0].customerReviewsCollectionIncluded" => False ...
Is there anything out-of-the-box that works for arbitrary JSON?