I'm trying to read values of a raw JSON POST request, and convert only the passed in field (key) names to an object.
If I post a JSON string such as:
{
"FirstName": "Test",
"LastName": "User",
"MiddleInitials": null
}
And then I convert the JSON string to an object, after reading the input stream from the request body:
// Read the InputStream
StreamReader reader = new StreamReader(Request.Body);
reader.BaseStream.Position = 0;
string jsonText = reader.ReadToEnd();
// Deserialize to object and read property names
object jsonObject = JsonConvert.DeserializeObject(jsonText);
Then when I inspect the object, I see the following:
How do I just get the key values (FirstName, LastName, MiddleInitials)?