locked
While converting XML to JSON using c#, By providing the data within the class,I’m getting the output.I need to fetch data from file present in folder .Could anyone please help on this RRS feed

  • Question

  • using Newtonsoft.Json;
    using System;
    using System.Windows.Forms;
    using System.Xml;

    namespace WindowsFormsApp1
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }

            
            private void Form1_Load(object sender, EventArgs e)
            {
                XmlDocument doc = new XmlDocument();
                doc.LoadXml(" <Student>\r\n    <Student_Name>Preethi</Student_Name>\r\n    <SSN>45679</SSN>\r\n    <Course>Electronics and communication</Course>\r\n    <Address>\r\n      <Line_1>#1, 6th cross</Line_1>\r\n      <Line_2>Victoria Layout</Line_2>\r\n      <City>Bangalore</City>\r\n      <Country>India</Country>\r\n    </Address>\r\n  </Student>\r\n</Root>");
                string jsonText = JsonConvert.SerializeXmlNode(doc);
                //Console.WriteLine(jsonText);
                MessageBox.Show(jsonText);
            }
        }
    }
    Wednesday, March 14, 2018 7:30 PM