-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Closed
Labels
api-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedarea-System.Text.Jsonhelp wanted[up-for-grabs] Good issue for external contributors[up-for-grabs] Good issue for external contributorsin-prThere is an active PR which will close this issue when it is mergedThere is an active PR which will close this issue when it is merged
Milestone
Description
API Proposal
Even though JsonElement exposes API for getting the length of a given array, there is no equivalent functionality for objects:
namespace System.Text.Json;
public partial struct JsonElement
{
public int GetArrayLength();
+ public int GetPropertyCount();
}API Usage
JsonElement element = JsonSerializer.Deserialize<JsonElement>("""{ "foo" : 1, "bar" : 2 }""");
Console.WriteLine(element.GetPropertyCount()); // 2/cc @bartonjs
Metadata
Metadata
Assignees
Labels
api-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedarea-System.Text.Jsonhelp wanted[up-for-grabs] Good issue for external contributors[up-for-grabs] Good issue for external contributorsin-prThere is an active PR which will close this issue when it is mergedThere is an active PR which will close this issue when it is merged