Reputation: 14610
I have this json object that looks like this below but I can't figure out how to acccess the objects data
I want to access the 5th index like this
jsonContent[5] error CS0021: Cannot apply indexing with [] to an expression of type 'object'
Upvotes: 2
Views: 134
Reputation: 14610
Here is what is needed, using the JObject library.
var currency = (jsonContent["quotes"] as JObject)["USD"].Value<decimal>();
Upvotes: 0
Reputation: 21
It looks like an object rather than array. So try jsonContent["5"] or jsonContent["[5]"] instead ?
Upvotes: 2