- Home
- Forum
- ASP.NET Core - EJ 2
- Timezone in Scheduler; slight confusion
Timezone in Scheduler; slight confusion
- StartTime: Tue Apr 02 2019 20:00:00 GMT+0200 (Central European Summer Time)
- Do I have to manipulate the data from the database for the GET method?
- Purpose of adding the below line in your application.
- Whether you have faced any issue without adding this line, if yes please share the issue details.
- Purpose of adding the below line in your application.
options.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
- Whether you have faced any issue without adding this line, if yes please share the issue details.
Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.CheckForCircularReference(JsonWriter writer, object value, JsonProperty property, JsonContract contract, JsonContainerContract containerContract, JsonProperty containerProperty)
Hi @Nevitha Ravi,
I tried the code sample you provided, but its throwing following error-
error CS1061: 'JsonOptions' does not contain a definition for 'SerializerSettings' and no accessible extension method 'SerializerSettings' accepting a first argument of type 'JsonOptions' could be found (are you missing a using directive or an assembly reference?)
I have also added the following package with the mentioned version-
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
can you please help??
PamTheOK, We checked our shared sample at our end and it works as expected. We suspect that you are using the provided solution on the core sample project which uses the .net core version greater than 2. You can resolve the problem by installing the NuGet package “Microsoft.AspNetCore.Mvc.NewtonsoftJson” and use the solution as shown in the below code snippet. Refer to the below link for more details.
https://stackoverflow.com/questions/55666826/where-did-imvcbuilder-addjsonoptions-go-in-net-core-3-0
[Program.cs]
|
builder.Services.AddMvc().AddNewtonsoftJson(x => { x.SerializerSettings.ContractResolver = new DefaultContractResolver(); }) .AddNewtonsoftJson(x => x.SerializerSettings.DateFormatHandling = Newtonsoft.Json.DateFormatHandling.MicrosoftDateFormat) .AddNewtonsoftJson(x => x.SerializerSettings.DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Local); |
Hi Venkatesh,
The above code worked for me, thanks for it.
But one weird thing that I noticed is after using the code snippet in my code, I am getting all the API responses in Pascal Case, where as earlier it was Camel Case. and due to this change my data from other API is not loading on the page despite of getting data from API.
attaching screenshots link for reference-
https://drive.google.com/drive/folders/1X9qDjWyVANydoT2S7RNaydwPH0mQZYUL?usp=share_link
PamTheOK, You can resolve the problem by removing the highlighted line in the snip.
- 9 Replies
- 5 Participants
-
ST Stefan
- Apr 2, 2019 07:57 PM UTC
- Dec 2, 2022 03:12 PM UTC