Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here is how you do using <a href="https://github.com/facebook-csharp-sdk/simple-json">https://github.com/facebook-csharp-sdk/simple-json</a> ( <a href="https://nuget.org/packages/SimpleJson">https://nuget.org/packages/SimpleJson</a> ).</p> <pre><code>var text = "{\"query\":{\"pages\":{\"6695\":{\"pageid\":6695,\"ns\":0,\"title\":\"Citadel\",\"touched\":\"2012-01-03T19:16:16Z\",\"lastrevid\":468683764,\"counter\":\"\",\"length\":8899}}}}"; </code></pre> <p>(Using dynamic)</p> <pre><code>dynamic json = SimpleJson.DeserializeObject(text); string title = json.query.pages["6695"].title; foreach (KeyValuePair&lt;string, dynamic&gt; page in json.query.pages) { var id = page.Key; var pageId = page.Value.pageid; var ns = page.Value.ns; } </code></pre> <p>(Using strongly typed classes)</p> <pre><code>class result { public query query { get; set; } } class query { public IDictionary&lt;string, page&gt; pages { get; set; } } class page { public long pageid { get; set; } public string title { get; set; } } var result = SimpleJson.DeserializeObject&lt;result&gt;(text); </code></pre> <p><strong>[Update]</strong></p> <p>on windows phone where dynamic is not supported and you don't want to use strongly typed classes.</p> <pre><code>var json = (IDictionary&lt;string, object&gt;)SimpleJson.DeserializeObject(text); var query = (IDictionary&lt;string, object&gt;)json["query"]; var pages = (IDictionary&lt;string, object&gt;)query["pages"]; var pageKeys = pages.Keys; var page = (IDictionary&lt;string, object&gt;)pages["6695"]; var title = (string)page["title"]; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload