I am developing an application using ASP.NET MVC 4 and it involves web API call where the result I am getting for a specific record is a Json string. I am doing this web API call inside an action method of a controller and the result I am getting for such call is in the following form:
result = "{\"fname\":\"John\",\"lname\":\"Doe\",\"empno\":123456,\"dept\":\"IT\"}"
I am new to MVC and Json and would really appreciate any help on how I can extract specific values from this Json string such as the value for dept?
Thanks.
In order to use this as an actual object in your project you will need to deserialize this string. .NET has it’s own deserialization or you can check out Json.Net which is pretty simple to figure out. Check out the documentation on JsonConvert.DeserializeObject<>…
ie…