-
Notifications
You must be signed in to change notification settings - Fork 46
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
Exception when deserializing a feature with nested object in properties (I think) #116
Comments
|
Thanks for the super fast response! But why can't I deserialize to a concrete object? |
4STJ deserializes features to its own internal implementation of
IIRC, the {
"type": "Feature",
"id": 1,
"geometry": { "type": "Point", "coordinates": [0,0] },
"properties": {
"id": "e7b67869-899e-4fee-8ef4-905e4d7ef7d1",
"name": "Something"
}
} only one of the two "id" values would make it onto the In theory, what we did for STJ can also be called ambiguous when it comes to writing out a concrete Lines 13 to 18 in 368733d
...but we also let you override the property that we look for, just in case you want to use that unusual name in the Line 97 in 368733d
|
See also: #44 (comment) |
Thanks for the info one again! |
I think we can actually make this a lot better simply by removing our If it's REALLY important for us to be able to deserialize to the concrete
The wiki has more complete usage samples for integrating with ASP.NET Core applications. If you don't have a need for any of the ID-related parts, then the only thing you should have to do is make sure that you're deserializing to |
Changing the following line, still doesn't allow deserializing to |
@airbreather do I need to change my code to use |
When creating / writing features, there's no issue with using |
Thanks for the info and the hand holding. |
BTW @airbreather, if I specify a field in the properties for the id (one of the factory parameters), will it be removed when serializing/deserializing with STJ? |
Each time I try to serialize an object with a Geometry (GeoJSON) attribute, I get:
I'm using System.Text.Json and 4STJ and I added GeoJsonConverterFactory converter. I also tried adding AllowNamedFloatingPointLiterals but is still not working. |
I've created the following test for geojson4stj (I wanted to migrate from newtonsoft to STJ):
This test is failing with an exception about unableing to convert from
IFeature
toFeature
or something similar.I think this was also a problem with the previous non STJ implementation, but I can't find the relevant issue :-(
I think the problem is with the nested object inside the properties, I haven't tried to narrow down the geojson feature.
Let me know if there's anything I can do to help out.
The text was updated successfully, but these errors were encountered: