Skip to content

Commit

Permalink
Fix JsonNode.ToString allocations (#85886)
Browse files Browse the repository at this point in the history
  • Loading branch information
pentp authored May 7, 2023
1 parent fd3eff2 commit b9b5fef
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public string ToJsonString(JsonSerializerOptions? options = null)
WriteTo(writer, options);
}

return JsonHelpers.Utf8GetString(output.WrittenMemory.ToArray());
return JsonHelpers.Utf8GetString(output.WrittenMemory.Span);
}

/// <summary>
Expand Down Expand Up @@ -51,7 +51,7 @@ public override string ToString()
WriteTo(writer);
}

return JsonHelpers.Utf8GetString(output.WrittenMemory.ToArray());
return JsonHelpers.Utf8GetString(output.WrittenMemory.Span);
}

/// <summary>
Expand Down

0 comments on commit b9b5fef

Please sign in to comment.