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 me on this.
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(" \r\n Preethi \r\n 45679 \r\n Electronics and communication \r\n
\r\n
#1, 6th cross
\r\n
Victoria Layout
\r\n Bangalore \r\n India \r\n
\r\n \r\n");
string jsonText = JsonConvert.SerializeXmlNode(doc);
//Console.WriteLine(jsonText);
MessageBox.Show(jsonText);
}
}
}

Nitin SontakkeRank #264 · 9.6K reputationPosted Mar 14, 2018, 6:15 PM EDT
Ravi PatelRank #439 · 5.7K reputationPosted Mar 14, 2018, 5:20 PM EDT
dhanu shree58 reputationPosted Mar 14, 2018, 7:52 PM EDT