-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Use JsonPatchDocument without Newtonsoft.Json #12994
Comments
The following hack seems to work:
Is there any more elegang way to accomplish JsonPatch support? |
Thanks for contacting us, @rmja. |
@mkArtakMSFT year, but that replaces the System.Text.Json formatter for all json which is really unfortunate. How do I use Json.Net only for |
A PATCH request to WebAPI always returns an UnsupportedMediaType Response. Taking a dependence on Newtonsoft.Json (and calling AddNetwtonsoftJson()) does not change that. I have tried decorating the method with a Consumes attribute, writing my own custom InputFormatter (which appear to be broken in general), even changing the ContentType Header to a media type that should be supported (IE: application\json), nothing seems to work. |
Describe the bug
The JsonPatchDocument does not specify a converter for the new
System.Text.Json
serializer and so any request to an action usingJsonPatchDocument<T>
returns a 400 model valutation error.To Reproduce
Steps to reproduce the behavior:
JsonPatchDocument<SomeModel>
[{"op":"replace","path":"/number","value":115}]
.Expected behavior
Excpect the parameter to be correctly bound to the patch and a status 200.
Additional context
Include the output of
dotnet --info
The text was updated successfully, but these errors were encountered: