I have a JToken with the value {1234}
How can I convert this to an Integer value as var totalDatas = 1234;
var tData = jObject[\"$totalDatas\"]; int tota
You can simply cast the JToken to int :
JToken
int
string json = @"{totalDatas : ""1234""}"; JObject obj = JObject.Parse(json); JToken token = obj["totalDatas"]; int result = (int)token; //print 2468 Console.WriteLine(result*2);
[.NET fiddle demo]