Double/long support for JTokenTypes?

Is there a way to designate that the Type of a JToken is of type double or long? I noticed that only integers and floats are supported via https://github.com/JamesNK/Newtonsoft.Json/blob/master/Src/Newtonsoft.Json/Linq/JTokenType.cs and wonder how people handle the higher precision cases.

Jon Skeet
people
quotationmark

JSON doesn't distinguish between double and float. It doesn't even really distinguish between integers and non-integers - they're just numbers.

But JsonTokenType.Float isn't really meant to indicate System.Single - it's "a floating point number". Likewise JsonTokenType.Integer isn't meant to indicate System.Int32 - it's "an integer".

For examples of this, look at JValue:

  • The constructor accepting long sets the token type to Integer
  • The constructor accepting double sets the token type to Float
  • The constructor accepting decimal sets the token type to Float

people

See more on this question at Stackoverflow