Developer Network
Developer Network
Developer Network
ProfileText
ProfileText
:CreateViewProfileText:
Sign in
Subscriber portal
Get tools
Downloads
Visual Studio
SDKs
Trial software
Free downloads
Office resources
Programs
Subscriptions
Overview
Administrators
Students
Microsoft Imagine
Microsoft Student Partners
ISV
Startups
Events
Community
Magazine
Forums
Blogs
Channel 9
Documentation
APIs and reference
Dev centers
Samples
Retired content
We’re sorry. The content you requested has been removed. You’ll be auto redirected in 1 second.
Ask a question
Quick access
Forums home
Browse forums users
FAQ
Search related threads
Remove From My Forums
Asked by:
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
Archived Forums SN-SZ
>
SQL Azure Labs Support
Question
0
Sign in to vote
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