Click or drag to resize
Json.NETConvert JSON to XML
 

This sample converts JSON to XML.

Sample
Usage
 1string json = @"{
 2  '@Id': 1,
 3  'Email': 'james@example.com',
 4  'Active': true,
 5  'CreatedDate': '2013-01-20T00:00:00Z',
 6  'Roles': [
 7    'User',
 8    'Admin'
 9  ],
10  'Team': {
11    '@Id': 2,
12    'Name': 'Software Developers',
13    'Description': 'Creators of fine software products and services.'
14  }
15}";
16
17XNode node = JsonConvert.DeserializeXNode(json, "Root");
18
19Console.WriteLine(node.ToString());
20// <Root Id="1">
21//   <Email>james@example.com</Email>
22//   <Active>true</Active>
23//   <CreatedDate>2013-01-20T00:00:00Z</CreatedDate>
24//   <Roles>User</Roles>
25//   <Roles>Admin</Roles>
26//   <Team Id="2">
27//     <Name>Software Developers</Name>
28//     <Description>Creators of fine software products and services.</Description>
29//   </Team>
30// </Root>