private void editToolStripMenuItem_Click(object sender, EventArgs e) { int i = 0; string text = System.IO.File.ReadAllText("test.json"); JsonTextReader reader = new JsonTextReader(new StringReader(text)); JsonColumn test = new JsonColumn { Property = "", Value = "" }; JsonTreeWrapper masterTree = new JsonTreeWrapper(); String jProp = "", jVal = ""; List <String> jValList = new List <String>(); bool arrayFlag = false; //Parse JSON while (reader.Read()) { //If a property type save value if (reader.TokenType.ToString() == "PropertyName") { //test.Property = reader.Value.ToString(); jProp = reader.Value.ToString(); } //if a string value, set it and add to master tree else if (reader.TokenType.ToString() == "String" || reader.TokenType.ToString() == "Integer") { if (!arrayFlag) { //test.Value = reader.Value.ToString(); jVal = reader.Value.ToString(); masterTree.addObject(new JsonTreeObject(jProp, jVal)); jProp = ""; jVal = ""; } else { jValList.Add(reader.Value.ToString()); } } else if (reader.TokenType.ToString() == "StartArray") { arrayFlag = true; } else if (reader.TokenType.ToString() == "EndArray") { masterTree.addObject(new JsonTreeObject(jProp, jValList)); arrayFlag = false; jValList.Clear(); } } masterTree.printTree(); }