Skip to content

Instantly share code, notes, and snippets.

@tonysneed
Created January 26, 2022 21:49
Show Gist options
  • Save tonysneed/7805e05035ab332e2b85e8984c864c8c to your computer and use it in GitHub Desktop.
Save tonysneed/7805e05035ab332e2b85e8984c864c8c to your computer and use it in GitHub Desktop.
Save class as Json
void SaveLocalSagaConfig(SagaConfigurationDto sagaConfig)
{
var options = new JsonSerializerOptions
{
WriteIndented = true,
Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping
};
var json = JsonSerializer.Serialize(sagaConfig, options);
File.WriteAllText(settings.SagaConfigPath, json);
}
@johha86
Copy link

johha86 commented Jan 26, 2022

Very cool! Thanks @tonysneed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment