What\'s the best practice for retrieving JSON values that may not even exist in C# using Json.NET?
Right now I\'m dealing with a JSON provider that returns JSON that
This is pretty much what the generic method Value() is for. You get exactly the behavior you want if you combine it with nullable value types and the ?? operator:
??
width = jToken.Value("width") ?? 100;