Skip to content

Instantly share code, notes, and snippets.

@Calabonga
Created September 3, 2022 03:44
Show Gist options
  • Save Calabonga/b4d9e8ba36fa4c71808f3b88172e5048 to your computer and use it in GitHub Desktop.
Save Calabonga/b4d9e8ba36fa4c71808f3b88172e5048 to your computer and use it in GitHub Desktop.
JsonSerializerOptions
var options = new JsonSerializerOptions
{
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping,
ReferenceHandler = ReferenceHandler.IgnoreCycles,
WriteIndented = true
}
var json = JsonSerializer.Serialize(state, options);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment