Quantcast
Channel: Safe JSON navigation - Stack Overflow
Browsing latest articles
Browse All 2 View Live

Answer by StriplingWarrior for Safe JSON navigation

For the exact syntax you mention, you can cast your JObject as dynamic.var jObj = JsonConvert.DeserializeObject<dynamic>(text);string value1 = jObj.foo?.bar?.baz ?? "default";Here's a LINQPad...

View Article


Safe JSON navigation

Is there a way to navigate a JSON safely?Given this JSON,{"foo": { "bar": { "baz": "quz" } } }I'd like to navigate it safely similar to the line below without creating types for all of them.string...

View Article

Browsing latest articles
Browse All 2 View Live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>