JObject IReferences.GetReferred(JObject obj) { var refProperty = obj.Property("$ref"); if (refProperty != null && !(refProperty.Value is null)) { var refId = refProperty.Value.Value <string>(); if (_refs.TryGetReferred(refId, out var refObj)) { return(refObj); } else { throw new InvalidOperationException($"The reference to '{refId}' does not exist."); } } return(obj); }