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

Not able to serialize using library GeoJSON4STJ #123

Closed
mhosman opened this issue Mar 2, 2023 · 2 comments
Closed

Not able to serialize using library GeoJSON4STJ #123

mhosman opened this issue Mar 2, 2023 · 2 comments

Comments

@mhosman
Copy link

mhosman commented Mar 2, 2023

With GeoJSON4STJ, using System.Text.Json, and trying to serialize an object with Geometry attribute, I get:

".NET number values such as positive and negative infinity cannot be written as valid JSON. To make it work when using 'JsonSerializer', consider specifying 'JsonNumberHandling.AllowNamedFloatingPointLiterals' (see https://docs.microsoft.com/dotnet/api/system.text.json.serialization.jsonnumberhandling)."

I already added:

options.JsonSerializerOptions.Converters.Add(new NetTopologySuite.IO.Converters.GeoJsonConverterFactory());

And even:

options.JsonSerializerOptions.NumberHandling = JsonNumberHandling.AllowNamedFloatingPointLiterals

But is not working...

@FObermaier
Copy link
Member

Could you set up a unit test that demonstrates the issue?

@mhosman
Copy link
Author

mhosman commented Mar 4, 2023

Closing. This is related to: dotnet/efcore#28811

@mhosman mhosman closed this as completed Mar 4, 2023
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

2 participants