You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have updated HotChocolate from 12 to 14 and I can't seem to find a way to force HotChocolate to use NewtonsoftJson instead of System.Text.Json for serializing the responses.
Previously I could do something like:
/// <summary>
/// The Hot Chocolate <see cref="DefaultHttpResultSerializer"/> the uses the NewtonsoftJson for serialization
/// </summary>
public class GraphQLNewtonsoftJsonHttpResultSerializer : DefaultHttpResultSerializer
{
/// <inheritdoc/>
public override async ValueTask SerializeAsync(IExecutionResult result, Stream stream, CancellationToken cancellationToken)
{
// Initialize a JSON writer
var writer = new JsonTextWriter(new StreamWriter(stream));
// Write the raw JSON
await writer.WriteRawAsync(JsonConvert.SerializeObject(result.ToResponseModel(), Formatting.None, NewtonsoftHelpers.Settings), cancellationToken);
// Flush the text
await writer.FlushAsync(cancellationToken);
// Return
return;
}
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I have updated HotChocolate from 12 to 14 and I can't seem to find a way to force HotChocolate to use NewtonsoftJson instead of System.Text.Json for serializing the responses.
Previously I could do something like:
Is there a way to do something like similar?
Beta Was this translation helpful? Give feedback.
All reactions