Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am getting some data from Gov tracker ( and creating a Windows 8 Store application..

I started out trying to use the HttpClient to get the JSON and then use to convert it to classes... But then I had no idea what to do with this giant class and the line

  var contacts = JsonArray.Parse(data);

would not work..

So now I requested it as XML and I am using XML to LINQ to slowly get what I need ..for example..

    var things = from x in xdoc.Descendants("person")
                     select new Person
                         firstname = x.Element("firstname").Value

But in this case and in general what is the easiest way? Is it using XML for this windows 8 application and using JSON to javascript applications? (since I always hear about how JSON fits so well with javascript)

At the moment since I could not get the JSON deserialization to work I guess XML is easier in this case?

share|improve this question
Is this MS article: How to: Serialize and Deserialize JSON Data relevant? – Dan Pichelman Jun 21 '13 at 15:34

I'm going to bet that the data retrieved from most REST URLs is a JSON object, not an array. The distinction is something like this:

array===> [1, 2, 3, 4]
object containing an array===> { "numbers": [1, 2, 3, 4] }

I don't know the library you're using, but I'm betting the method you're looking for is JsonObject.Parse(data), and then something to retrieve the specific property you want (ie, "numbers" above). You could edit your post with some sample text data if you want us to confirm. I would recommend if the data is not public, then replace the actual values with made-up stuff to maintain data privacy.

Which one is easier to use may depend on what you're used to, or which developers you tend to work with. Many would argue in favor of JSON, since it could be easier to program for, supports arrays directly, and it tends to have less of a network footprint. Still, it does seem to be a not-so-consequential matter of preference and your app could certainly work fine just using XML. (There may also be some data types more easily represented in an XML-based format; for instance, declarative UI languages like HTML)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.