Skip to content

Commit f921856

Browse files
authored
Fix replace redundant round-trip in JsonSerializer.Parse with Clone (#8536)
1 parent 6d4bae8 commit f921856

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

src/StrawberryShake/Client/src/Core/Serialization/JsonSerializer.cs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,7 @@ public JsonSerializer(string typeName = BuiltInScalarNames.Any)
1515

1616
public override JsonElement Parse(JsonElement serializedValue)
1717
{
18-
using var writer = new ArrayWriter();
19-
20-
// write json value to buffer.
21-
using var jsonWriter = new Utf8JsonWriter(writer);
22-
serializedValue.WriteTo(jsonWriter);
23-
jsonWriter.Flush();
24-
25-
// now we read the buffer and create an element that does not need to be disposed.
26-
var reader = new Utf8JsonReader(writer.GetWrittenSpan(), true, default);
27-
return JsonElement.ParseValue(ref reader);
18+
return serializedValue.Clone();
2819
}
2920

3021
protected override JsonElement Format(JsonElement runtimeValue)

0 commit comments

Comments
 (0)