/// <inheritdoc/> public override bool TryGetElement(int index, out VariantValue value) { if (index >= 0 && Token is JArray o && index < o.Count) { value = new JsonVariantValue(o[index], _serializer); return(true); } value = new JsonVariantValue(null, _serializer); return(false); }
/// <inheritdoc/> protected override VariantValue AddProperty(string property) { if (Token is JObject o) { var child = new JsonVariantValue(null, _serializer); // Add to object o.Add(property, child.Token); return(child); } throw new NotSupportedException("Not an object"); }
/// <inheritdoc/> public override bool TryGetProperty(string key, out VariantValue value, StringComparison compare) { if (Token is JObject o) { var success = o.TryGetValue(key, compare, out var token); if (success) { value = new JsonVariantValue(token, _serializer); return(true); } } value = new JsonVariantValue(null, _serializer); return(false); }