Skip to content

Blazor Deserialization error #11476

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Julien-Marpault opened this issue Jun 23, 2019 · 1 comment
Closed

Blazor Deserialization error #11476

Julien-Marpault opened this issue Jun 23, 2019 · 1 comment
Labels
area-blazor Includes: Blazor, Razor Components External This is an issue in a component not contained in this repository. It is open for tracking purposes.

Comments

@Julien-Marpault
Copy link

With upgrade to .NEt core 3 review 6 I get a deserialization issue with date using HttpClient.GetJsonAsync() in Blazor

Here is the json:

{
    "id": 1,
    "priority": 2,
    "type": 1,
    "status": 3,
    "title": "Ralentissements importants lors de la consultation d'une fiche produit",
    "creationdate": "2019-06-11T00:00:00",
    "userId": 13
}

If I use this code:

Ticket = await Http.GetJsonAsync<TicketDetailsDto>($"api/tickets/{TicketId}");

The date is not deserialized correctly an I get a January 1st date

If I use this code:

HttpResponseMessage response = await Http.GetAsync($"api/tickets/{TicketId}");
string jsonString = await response.Content.ReadAsStringAsync();
Ticket = JsonConvert.DeserializeObject<TicketDetailsDto>(jsonString);

the date is correctly deserialized.

@mkArtakMSFT mkArtakMSFT added the area-blazor Includes: Blazor, Razor Components label Jun 23, 2019
@mkArtakMSFT
Copy link
Member

Thanks for contacting us, @JulienM28.
We rely on System.Text.Json for deserializing data. You can read more about this at: https://github.com/dotnet/corefx/blob/master/src/System.Text.Json/docs/SerializerProgrammingModel.md#date-support

@mkArtakMSFT mkArtakMSFT added the External This is an issue in a component not contained in this repository. It is open for tracking purposes. label Jun 24, 2019
@ghost ghost locked as resolved and limited conversation to collaborators Dec 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Includes: Blazor, Razor Components External This is an issue in a component not contained in this repository. It is open for tracking purposes.
Projects
None yet
Development

No branches or pull requests

2 participants