var results = JsonConvert.DeserializeObject(jsonResponseFromApi); var oneThingIWant = results.thingYouWant; var anotherThingIWant = results.something.somethingDeeper;
Friday, 6 February 2015
Using C# dynamic type and NewtonSoft.Json to deserialize JSON
Today I had a requirement to poke a JSON api and capture the response as part of a payment gateway, all from my C# code-behind in a .Net webforms project. Dynamic seemed a good way to go:
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Comments are moderated, so you'll have to wait a little bit before they appear!