I have JsonObject that is created like this:
JsonObject jsonObj = JsonNode.Parse(inputString).AsObject();
I then get property value from it like this
if (jsonObj.TryGetPropertyValue("property1", out JsonNode? property))
{
var myProp = property.GetValue<string>();
}
Is there a way to lookup ValueKind of that property?
property.ValueKind
is not working.
In here there is an example with ValueKind, but it's getting it from JsonDocument.RootElement, but not from JsonObject:
...
using JsonDocument document = JsonDocument.Parse(jsonString, documentOptions);
JsonElement root = document.RootElement;
if (root.ValueKind == JsonValueKind.Object)
{
...
And there is no RootElement for JsonNode or JsonObject.
Is there a way to get ValueKind from JsonObject? I can see in VisualStudio that it is there embedded in the Value:
Thank you.