Support JsonEncodedText propertyName for JsonElement.TryGetProperty #53855
-
Is there a specific reason why The current workaround is to pass in the System.Text.Json.JsonEncodedText nameJson = System.Text.Json.JsonEncodedText.Encode("name");
System.Text.Json.JsonDocument doc = ...;
doc.RootElement.TryGetProperty(nameJson.EncodedUtf8Bytes, out System.Text.Json.JsonElement _); Suggestion: namespace System.Text.Json
{
public readonly struct JsonElement
{
// existing methods
public bool TryGetProperty(ReadOnlySpan<byte> utf8PropertyName, out JsonElement value);
public bool TryGetProperty(ReadOnlySpan<char> propertyName, out JsonElement value);
public bool TryGetProperty(string propertyName, out JsonElement value);
+ public bool TryGetProperty(JsonEncodedText propertyName, out JsonElement value);
}
} The same question also applies to |
Beta Was this translation helpful? Give feedback.
Answered by
huoyaoyuan
Jun 8, 2021
Replies: 1 comment 1 reply
-
This is an api suggestion and is better to be an issue. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
campersau
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is an api suggestion and is better to be an issue.