text: CodePlexProject Hosting for Open Source Software
  Hi guys,
  I'm using Json schema feature in Json.net to validate the schema of my RESTful API responses. However when I use the isValid() method to valid I only see one version of this method that returns a bool. According to James' post ()
  this method should be overloaded to also return the position of the error is one occurs.
  With this code I am only seeing one option i.e. no overloads for isValid(). Is there something I'm missing here? Thanks.
  using Newtonsoft.Json;
  using Newtonsoft.Json.Linq;
  using Newtonsoft.Json.Schema;
  // And other MS and NUnit references that I need to get this working. JsonSchema schema;
  // Read json schema
  using (var streamReader = new StreamReader(schemaFile) {
  schema = JsonSchema.Parse(streamReader.ReadToEnd());
  }
  // Call RESTful API
  var request = WebRequest.Create(RestfulAPICall) as HttpWebRequest;
  // Get response and validate against schema
  using (var response = request.GetResponse().GetResponseStream()) {
  var responseString = new StreamReader(response).ReadToEnd();
  var jsonResponse = JObject.Parse(responseString);
  Assert.That(jsonResponse.IsValid(schema), Is.True);
  }
  I have the same problem!
  I've tried this approach but it fails. I have no idea if Json.Net supports error messages at all, how do I get some message back that says why the validation failed?
  (FROM CODE)
  SHouldn't it throw an exception with information? Or
  I'm working with this:
  JObject person = JObject.Parse(@"{
  ""Major"": 3,
  ""Minor"": 5,
  ""Build"": 0,
  ""Revision"": 2,
  ""MajorRevision"": 0,
  ""MinorRevision"": 2
  }");
  // what is perosn.Value?
  // person.Validate(schema); // Valid(schema);
  try{
  person.IsValid(schema);
  } catch (Exception ex){
  ;
  }
  THere seems to be no way of getting an error message though it's either Person.IsValid == true or == false
  How do I get an error message back from json.net??
  Please help!
  Are you sure you want to delete this post? You will not be able to recover it later.
  Are you sure you want to delete this thread? You will not be able to recover it later.