Skip to content

Commit 1ec52c1

Browse files
committed
Use RC1 version of System.Text.Json
1 parent d2dffea commit 1ec52c1

File tree

3 files changed

+4
-12
lines changed

3 files changed

+4
-12
lines changed

Source/Common/ValuesJsonConverter.cs

+2-10
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ public virtual void WriteObject(Utf8JsonWriter writer, object? value, JsonSerial
201201
var targetType = targetTypes[i];
202202
if (targetType.IsAssignableFrom(explicitType))
203203
{
204-
return ProcessObject(objectRoot, explicitType!, options);
204+
return objectRoot.Deserialize(explicitType!, options);
205205
}
206206
}
207207
}
@@ -224,7 +224,7 @@ public virtual void WriteObject(Utf8JsonWriter writer, object? value, JsonSerial
224224
localTargetType = concreteType!;
225225
}
226226

227-
return ProcessObject(objectRoot, localTargetType, options);
227+
return objectRoot.Deserialize(localTargetType, options);
228228
}
229229
#pragma warning disable CA1031 // Do not catch general exception types
230230
catch (Exception ex)
@@ -489,13 +489,5 @@ private static bool TryGetConcreteType(
489489
#pragma warning restore CA1031 // Do not catch general exception types
490490
}
491491
}
492-
493-
private static object? ProcessObject(JsonElement element, Type objectType, JsonSerializerOptions options)
494-
{
495-
// TODO: Investigate avoiding the string allocation
496-
// Related issue: https://github.com/dotnet/runtime/issues/31274
497-
var json = element.GetRawText();
498-
return JsonSerializer.Deserialize(json, objectType ?? typeof(object), options);
499-
}
500492
}
501493
}

Source/Schema.NET.Pending/Schema.NET.Pending.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
</PropertyGroup>
1515

1616
<ItemGroup Label="Package References">
17-
<PackageReference Include="System.Text.Json" Version="6.0.0-preview.7.21377.19" />
17+
<PackageReference Include="System.Text.Json" Version="6.0.0-rc.1.21451.13" />
1818
<PackageReference Include="System.Memory" Version="4.5.4" />
1919
<ProjectReference Include="../../Tools/Schema.NET.Tool/Schema.NET.Tool.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
2020
</ItemGroup>

Source/Schema.NET/Schema.NET.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
</PropertyGroup>
1515

1616
<ItemGroup Label="Package References">
17-
<PackageReference Include="System.Text.Json" Version="6.0.0-preview.7.21377.19" />
17+
<PackageReference Include="System.Text.Json" Version="6.0.0-rc.1.21451.13" />
1818
<PackageReference Include="System.Memory" Version="4.5.4" />
1919
<ProjectReference Include="../../Tools/Schema.NET.Tool/Schema.NET.Tool.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
2020
</ItemGroup>

0 commit comments

Comments
 (0)