~ubuntu-branches/ubuntu/trusty/monodevelop/trusty-proposed

« back to all changes in this revision

Viewing changes to external/Newtonsoft.Json/Doc/JsonNetVsWindowsDataJson.aml

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-05-12 09:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20130512094603-mad323bzcxvmcam0
Tags: upstream-4.0.5+dfsg
Import upstream version 4.0.5+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="utf-8"?>
 
2
<topic id="JsonNetVsWindowsDataJson" revisionNumber="1">
 
3
  <developerConceptualDocument xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:xlink="http://www.w3.org/1999/xlink">
 
4
    <introduction>
 
5
      <para>Windows 8 introduces a new way to work with JSON via the <externalLink>
 
6
<linkText>Windows.Data.Json</linkText>
 
7
<linkUri>http://msdn.microsoft.com/en-us/library/windows/apps/xaml/br240639.aspx</linkUri>
 
8
<linkTarget>_blank</linkTarget>
 
9
</externalLink> namespace. Similar to LINQ to JSON in Json.NET
 
10
      it defines classes that can be used to parse values, strings, objects, and arrays from
 
11
      JSON text or serialize value types into JSON text.</para>
 
12
      <para>Below is a comparison of Json.NET&apos;s LINQ to JSON to Window 8&apos;s Windows.Data.Json.</para>
 
13
    </introduction>
 
14
    <section>
 
15
      <title>Exclusive Json.NET Features</title>
 
16
      <content>
 
17
<list class="bullet">
 
18
   <listItem>
 
19
     <para>
 
20
       Runs on .NET 2, .NET 3, .NET 4, Silverlight and Windows Phone 7
 
21
     </para>
 
22
   </listItem>
 
23
   <listItem>
 
24
     <para>
 
25
       Dynamic programming
 
26
     </para>
 
27
   </listItem>
 
28
   <listItem>
 
29
     <para>
 
30
       Write indented JSON
 
31
     </para>
 
32
   </listItem>
 
33
   <listItem>
 
34
     <para>
 
35
       Customize reading and writing JSON with JsonConverters
 
36
     </para>
 
37
   </listItem>
 
38
   <listItem>
 
39
     <para>
 
40
       Read and write ISO8601 dates
 
41
     </para>
 
42
   </listItem>
 
43
   <listItem>
 
44
     <para>
 
45
       Better LINQ support
 
46
     </para>
 
47
   </listItem>
 
48
</list>
 
49
      </content>
 
50
    </section>
 
51
    <section>
 
52
      <title>Creating JSON</title>
 
53
      <content>
 
54
        <para>The big difference between the two libraries when creating JSON is Windows.Data.Json requires
 
55
        string/integer/double values to be explicitly converted to JsonValue objects.</para>
 
56
        <para>Note that there is a weird limitation to creating JSON with Windows.Data.Json: it doesn&apos;t
 
57
        allow you to set properties to null or put null values in an array.</para>
 
58
 
 
59
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\JsonNetVsWindowsDataJsonTests.cs" region="CreatingJSON" title="Creating JSON with Json.NET and Windows.Data.Json" />
 
60
        
 
61
      </content>
 
62
    </section>
 
63
    <section>
 
64
      <title>Querying JSON</title>
 
65
      <content>
 
66
        <para>Windows.Data.Json requires a value to be cast to its exact type with the GetObject/GetArray methods
 
67
        before it can be used, making Windows.Data.Json&apos;s code verbose compared to LINQ to JSON.</para>
 
68
 
 
69
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\JsonNetVsWindowsDataJsonTests.cs" region="QueryingJSON" title="Querying JSON with Json.NET and Windows.Data.Json" />
 
70
        
 
71
      </content>
 
72
    </section>
 
73
    <section>
 
74
      <title>Benchmarks</title>
 
75
      <content>
 
76
        <para>Json.NET is slightly slower at writing JSON than Windows.Data.Json but considerably faster at parsing JSON.</para>
 
77
        
 
78
        <mediaLink>
 
79
      <image class="image" xlink:href="jsonnetwindowsdatajson" mimeType="image/png" width="592" height="356" />
 
80
      <summary>Json.NET and Windows.Data.Json Performance</summary>
 
81
        </mediaLink>
 
82
        
 
83
      </content>
 
84
    </section>
 
85
    <section>
 
86
      <title>Converting Between LINQ to JSON and Windows.Data.Json</title>
 
87
      <content>
 
88
        <para>Json.NET supports converting between the types of the two libraries.
 
89
        This feature is useful if you are working with another API that uses Windows.Data.Json types but you want to use Json.NET inside your own code.</para>
 
90
        <para>Use <codeEntityReference>Overload:Newtonsoft.Json.Linq.JToken.FromObject</codeEntityReference> to convert a Windows.Data.Json
 
91
        value to LINQ to JSON and use <codeEntityReference>Overload:Newtonsoft.Json.Linq.JToken.ToObject</codeEntityReference> to convert LINQ to JSON to Windows.Data.Json.</para>
 
92
 
 
93
<code lang="cs" source="..\Src\Newtonsoft.Json.Tests\Documentation\JsonNetVsWindowsDataJsonTests.cs" region="Converting" title="Converting between Json.NET and Windows.Data.Json" />
 
94
        
 
95
      </content>
 
96
    </section>
 
97
    <relatedTopics>
 
98
      <codeEntityReference>N:Newtonsoft.Json.Linq</codeEntityReference>
 
99
    </relatedTopics>
 
100
  </developerConceptualDocument>
 
101
</topic>
 
 
b'\\ No newline at end of file'