title: Compare two JObjects or JArray
body: <p>I have this WPF application which gets data from REST web service and returns a JSON data. Then this data will be converted to xml. This xml file later will be converted back to JSON to be compared with new JSON data from REST web service calling same function. How do I do this?</p>
  
  <p>Here is a sample of what I did:</p>
  
  <pre><code>HTTPGet req = new HTTPGet();
              req.Request("http://restservice//function");
              string str= req.ResponseBody;
              StringBuilder xmlTemplate = new StringBuilder("{\"?xml\":{\"@version\": \"1.0\",\"@standalone\": \"no\"},\"root\":REPLACE }");
              StringBuilder json = xmlTemplate.Replace(Constants.Constants.XMLREPLACEVAL, str); //this so that it will be same with the JObject from XML file
              JObject jObject1 = JObject.Parse(json.ToString());
  
              XmlDocument doc = new XmlDocument();
              string xml = File.ReadAllText("json.xml");
              doc.LoadXml(xml);
              string jsonText = JsonConvert.SerializeXmlNode(doc);
              JObject jObject2 = JObject.Parse(jsonText);
  
              if(jObject1.Equals(jObject2))
                  //DO SOMETHING
  </code></pre>