Skip to content
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

NodaTime.Instant fails to serialize to JSON properly despite configuring Nodatime Serializer #543

Closed
JoshuaNitschke opened this issue Sep 12, 2023 · 5 comments
Milestone

Comments

@JoshuaNitschke
Copy link
Contributor

JoshuaNitschke commented Sep 12, 2023

I tried to configure the JSON serializer several different ways as you can see in the example repo, but I couldn't find a method / order that would serialize JSON responses as expected.

STEPS TO REPRODUCE

  1. Pull this branch: https://github.com/JoshuaNitschke/wolverine-issue-reproduction/tree/nodatime-issue
  2. Run the unit test

RESULT
image

EXPECTED RESULT
Instant to serialize in ISO-8601 pattern e.g. 2023-09-11T23:35:41.101553Z

OTHER RESOURCES
@alistair made this: https://github.com/alistair/wolverine/tree/configure_json_serializer
Discord report: https://discord.com/channels/1074998995086225460/1150925861458030655
Possibly related Marten issue: JasperFx/marten#2613

@alistair
Copy link
Contributor

Hey @JoshuaNitschke

There are actually 2 JsonOptions which exist. My belief is that you are configuring the Mvc version but not the Microsoft.AspNetCore.Http.Json.JsonOptions version which is what wolverine actually depends on.

See dotnet/aspnetcore#35904 for more detail

@JoshuaNitschke
Copy link
Contributor Author

JoshuaNitschke commented Sep 14, 2023

@alistair I don't think so - did you pull the repo?
image
image

alistair added a commit to alistair/wolverine that referenced this issue Sep 14, 2023
@alistair
Copy link
Contributor

Yeah I did but actually replicated it slightly differently. Just finished cleaning up my branch and created this above PR so that wolverine captures the IOption<> over referencing the JsonOption directly.

@JoshuaNitschke
Copy link
Contributor Author

@alistair thank you sir!!!

@jeremydmiller
Copy link
Member

This is resolved by @alistair 's fix here: #544

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants