There are many answers here which suggest the following ways to use JObject
as dynamic
.
dynamic dynObj = JObject.Parse(jsonString);
OR
dynamic dynObj = JsonConvert.DeserializeObject<dynamic>(jsonString);
My jsonString
is simple: {"id":"123","name":"abc"}
.
It does not seem to work in Newtonsoft.Json 9.0. When I try any of these, I still get an object with the Type object {Newtonsoft.Json.Linq.JObject}
.
And when I try to access a property by doing dynObj.id
I get an exception error CS1061: 'object' does not contain a definition for 'id' and no extension method 'id' accepting a first argument of type 'object' could be found
.