-
-
Notifications
You must be signed in to change notification settings - Fork 1.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
Support for blazor serialiser: Microsoft.JSInterop.Json #2237
Comments
You should be able to use Newtonsoft.Json in client-side Blazor apps. But the framework is switching to use the new System.Text.Json serializer. |
@dazinator what is the exact issue you're hitting? For example does adding a reference to NewtonSoft.Json to your client-side app lead to an error? |
@dougbo |
Last time I tried Blazor it worked flawlessly with Newtonsoft.Json and the generated clients and models could be used without problems. I think it doesn't make much sense to support Blazor's serializer as it will eventually use System.Text.Json. However it makes sense to add an option to generate models (DTOs) to use System.Text.Json's serializer, this is tracked here: RicoSuter/NJsonSchema#1013 I've created an epic regarding System.Text.Json support in general: |
@RicoSuter waiting for System.Text.Json works for me, closing |
I just checked out using nswag studio to generate a csharp client, for use within a blazor client side app.
Newtonsoft serializer is not available in blazor client side apps. However microsoft have provided the following json seriliasation mechanism for blazor apps based on Microsoft.JSInterop.Json:
Sadly I couldn't find any
stream
based serialisation operations, so when using this serialiser, current methods that use newtonsoft with streams would have to be replaced by the above two (i.e convert to string first).The text was updated successfully, but these errors were encountered: