Skip to content

Commit b938a02

Browse files
committed
Improve default JSON serializer options
1 parent e841588 commit b938a02

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

SQLiteSharp/Orm.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
using System.Text;
33
using System.Text.Json;
44
using System.Reflection;
5+
using System.Text.Encodings.Web;
6+
using System.Text.Json.Serialization;
57

68
namespace SQLiteSharp;
79

@@ -150,10 +152,12 @@ public string GetSqlDeclaration(SqliteColumn column) {
150152

151153
private void AddDefaultTypeSerializers() {
152154
JsonSerializerOptions jsonOptions = new() {
155+
NumberHandling = JsonNumberHandling.AllowNamedFloatingPointLiterals | JsonNumberHandling.AllowReadingFromString,
156+
AllowTrailingCommas = true,
153157
IncludeFields = true,
154158
NewLine = "\n",
155-
AllowTrailingCommas = true,
156159
ReadCommentHandling = JsonCommentHandling.Skip,
160+
Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping,
157161
};
158162
RegisterType<object>(
159163
sqliteType: SqliteType.Text,

0 commit comments

Comments
 (0)