-
-
Notifications
You must be signed in to change notification settings - Fork 390
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
JsonProperty ignored when deserialising response #706
Comments
What version of Flurl.Http are you using? |
Flurl.Http 4.0.0-pre2 |
Json.NET is being removed in 4.0, so its attributes won't work. https://github.com/tmenier/Flurl/releases/tag/Flurl.Http.4.0.0-pre1 Keep an eye on release notes before upgrading prereleases and the final 4.0.0, there's likely to be breaking changes with each iteration. |
Thanks for the response. Interested to know what the reason is to remove Json.NET? I saw the workaround in the link you sent on how to create your own |
The rationale is all laid out in #517. In short, lots of well-reasoned arguments coupled with tons of demand (more than any other feature request in recent memory). It was broadly applauded when I finally did it. I'm not sure why the serializer is any harder to use in tests than in the main app, can you explain? |
Of course another alternative is to embrace the switch and replace all your |
Okay thanks for the links, interesting reading.
I don't have a global setup/teardown or a unit test base class that I could simply initialise the serialiser. Do you have a hint on how you do it in your project? In the mean time I'll look into the possibility of using |
Off the top of my head, you could do it in the test class constructor, or even a static constructor of the test subject. Doesn't really matter, and it's not important that it only happens once. |
I feel I must be doing something wrong as this would be an obvious bug.
When deserialising the response with Flurl, the
JsonProperty
is ignored and the property is not set.If I name the property to be exactly the same as the json, then it does serialise correctly.
Unit test that fails;
And changing the
StickerColorDto
to this, the test passes;The text was updated successfully, but these errors were encountered: