-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Refactor creation of default JsonSerializerOptions
- Loading branch information
Alexander van Delft
committed
Nov 27, 2024
1 parent
e4da0af
commit 2022268
Showing
4 changed files
with
73 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// ------------------------------------------------------------------------------------------------------------------------------- | ||
// <copyright file="JsonSerializerOptionsCreator.cs" company="Starion Group S.A."> | ||
// Copyright (c) 2015-2024 Starion Group S.A. | ||
// | ||
// Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Nathanael Smiechowski, Antoine Théate, Omar Elebiary, Jaime Bernar | ||
// | ||
// This file is part of CDP4-COMET SDK Community Edition | ||
// | ||
// The CDP4-COMET SDK Community Edition is free software; you can redistribute it and/or | ||
// modify it under the terms of the GNU Lesser General Public | ||
// License as published by the Free Software Foundation; either | ||
// version 3 of the License, or (at your option) any later version. | ||
// | ||
// The CDP4-COMET SDK Community Edition is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
// Lesser General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU Lesser General Public License | ||
// along with this program; if not, write to the Free Software Foundation, | ||
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
// </copyright> | ||
// ------------------------------------------------------------------------------------------------------------------------------- | ||
|
||
namespace CDP4JsonSerializer.Helper | ||
{ | ||
using System.Text.Json; | ||
|
||
/// <summary> | ||
/// Static class that returns correct <see cref="JsonSerializerOptions"/> for serialization purposes | ||
/// </summary> | ||
public static class JsonSerializerOptionsCreator | ||
{ | ||
/// <summary> | ||
/// Creates the <see cref="JsonSerializerOptions"/> and returns the new instance | ||
/// </summary> | ||
/// <returns>the new instance</returns> | ||
public static JsonSerializerOptions CreateNew() | ||
{ | ||
return new JsonSerializerOptions | ||
{ | ||
WriteIndented = false, | ||
Encoder = System.Text.Encodings.Web.JavaScriptEncoder.UnsafeRelaxedJsonEscaping, | ||
PropertyNameCaseInsensitive = true, | ||
NumberHandling = System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString, | ||
}; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.