private void validateDesignDocument(string document, out JObject jObj) { try { jObj = JObject.Parse(document); } catch (JsonReaderException) { throw new ArgumentException("Document was not valid JSON"); } if (jObj["views"] == null) throw new ArgumentException("Design document must contain 'views' property"); }