I'm looking at the feasibility of creating a dynamic JSON service within my app that will link to outlying JSON services and pull in similar data (but it will have different names). That way, I won't have to create a JSON object / mapping for the 1000's of services that this will be connecting to. My thoughts are to create a mapping between the different JSON services and mine using a configuration created with in the app.
I'm able to create a dynamic JSON object from JSON data using this:
private static void Deserialize(string szJsonData)
{
dynamic dObj = JObject.Parse(szJsonData);
}
But to access data within that dynamic object, it appears I still need to know the name and access it like this:
string name = dObj.name;
What would make this feasible is if I could do something like this:
string nameMapping = "name";
string name = dObj[nameMapping];
Which would allow me to configure a dynamic mapping back to data within my app.
How could this be accomplished?