When I parse a String that contains a valid RFC3339 datetimestring, JOject.Parse() automatically makes an implizit type conversion to DateTime:
String toParse = "{\"datetime\": \"2020-08-04T23:45:00+02:00\"}";
JObject p = JObject.Parse(toParse);
String d = (String)p["datetime"];
Console.Write(d);
// Gives 08/04/2020 23:45:00
// But I want 2020-08-04T23:45:00+02:00
I think the "unwanted" typecast takes place while reading the p["datetime"]
and not during JOject.Parse()
, but how can I totally avoid that behavior and let it only deserialize everything as string?
I have this problem with different types, also decimals which are automatically casted, by I need them as String.
Thank you!