Example #1
0
        private void TestJson()
        {
            string  jsonStr  = "{'name':'dd','array':[11,22,33],'struct':{'name2':'xxx','name3':'xxx9999'},'arrayOfArray':[[1,2,3],[4,5,6],[3]]}";
            string  jsonStr2 = "{'name':'dd updated','array':[11,22,33,55],'struct':{'name2':'xxx','name3':'xxx9999'},'arrayOfArray':[[1,2],[4,5,6]]}";
            JObject jobject  = JObject.Parse(jsonStr);
            JObject jobject2 = JObject.Parse(jsonStr2);

            CompareHandler handler = new CompareHandler();

            CompareStruct compareResult = handler.CompareStruct(jobject, jobject2);

            string xml = compareResult.ToXML("descriptor");
            //foreach (var childNode in jobject.Children())
            //{
            //	//JValue, JArray, JObject
            //	var property = childNode as JProperty;
            //	string name = property.Name;
            //	var value = property.Value;
            //	var node = jobject[name];

            //	Console.WriteLine("name:" + name);
            //	Console.WriteLine("value:" + value);

            //}
        }
Example #2
0
        private void buttonOK_Click(object sender, EventArgs e)
        {
            var originalJson = GetJsonString(textBoxTableName.Text, textBoxQuery1.Text);
            var newJson      = GetJsonString(textBoxTableName.Text, textBoxQuery2.Text);

            JObject        jobject       = JObject.Parse(originalJson);
            JObject        jobject2      = JObject.Parse(newJson);
            CompareHandler handler       = new CompareHandler();
            CompareStruct  compareResult = handler.CompareStruct(jobject, jobject2);
            string         diffXML       = compareResult.ToXML("descriptor");
            string         xslContent    = GetXSL(textBoxTableName.Text);

            webBrowserResult.DocumentText = XslTransform(diffXML, xslContent);
        }
Example #3
0
        private void buttonCompare_Click(object sender, EventArgs e)
        {
            string jsonStr  = textBoxOriginal.Text;
            string jsonStr2 = textBoxNew.Text;

            JObject jobject  = JObject.Parse(jsonStr);
            JObject jobject2 = JObject.Parse(jsonStr2);

            CompareHandler handler = new CompareHandler();

            CompareStruct compareResult = handler.CompareStruct(jobject, jobject2);

            string xml = compareResult.ToXML("descriptor");

            textBoxResultXML.Text = xml;
        }