0

How to disable or prevent automatic datetime conversion when JArray.parse?

JArray ja = JArray.parse(fromString);  --> I didn't find the option in JsonLoadSettings 

disable the automatic converstion.

When running it in Postman, it works properly.

[
 {
    "startDate": "2022-10-03T22:03:15+00:00",
    "endDate": "2022-10-03T22:03:15+00:00"
  }
]

but when running in my C# code, it converted to UTC+0

how to keep the string with datetime value as it is?

Donald
  • 551
  • 2
  • 6
  • 22
  • Set `JsonSerializerSettings.DateParseHandling = DateParseHandling.None` and use `JsonConvert.DeserializeObject(fromString, new JsonSerializerSettings{ JsonSerializerSettings.DateParseHandling = DateParseHandling.None })` as shown in [this answer](https://stackoverflow.com/a/35141787/3744182) to [JToken: Get raw/original JSON value](https://stackoverflow.com/q/35138346/3744182). In fact I think this is a duplicate, agree? – dbc Oct 28 '22 at 17:08
  • Yes, thank you so much, the answer was there, and this question no more accept answer since it’s duplicated and I accepted it. Regards – Donald Oct 30 '22 at 01:24

0 Answers0