Skip to content

Commit 566bc12

Browse files
committed
Use RC1 version of System.Text.Json
1 parent 5613e96 commit 566bc12

File tree

3 files changed

+4
-12
lines changed

3 files changed

+4
-12
lines changed

Source/Common/ValuesJsonConverter.cs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ public virtual void WriteObject(Utf8JsonWriter writer, object? value, JsonSerial
185185
var targetType = targetTypes[i];
186186
if (targetType.IsAssignableFrom(explicitType))
187187
{
188-
return ProcessObject(objectRoot, explicitType!, options);
188+
return objectRoot.Deserialize(explicitType!, options);
189189
}
190190
}
191191
}
@@ -208,7 +208,7 @@ public virtual void WriteObject(Utf8JsonWriter writer, object? value, JsonSerial
208208
localTargetType = concreteType!;
209209
}
210210

211-
return ProcessObject(objectRoot, localTargetType, options);
211+
return objectRoot.Deserialize(localTargetType, options);
212212
}
213213
#pragma warning disable CA1031 // Do not catch general exception types
214214
catch (Exception ex)
@@ -473,13 +473,5 @@ private static bool TryGetConcreteType(
473473
#pragma warning restore CA1031 // Do not catch general exception types
474474
}
475475
}
476-
477-
private static object? ProcessObject(JsonElement element, Type objectType, JsonSerializerOptions options)
478-
{
479-
// TODO: Investigate avoiding the string allocation
480-
// Related issue: https://github.com/dotnet/runtime/issues/31274
481-
var json = element.GetRawText();
482-
return JsonSerializer.Deserialize(json, objectType ?? typeof(object), options);
483-
}
484476
}
485477
}

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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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)