900v3n
900v3n

Reputation: 1

Retrieve JSON from a website (Windows phone 7)

I am developing an app that has foursquare in it. I am having problem in retrieving JSON from the website. How to do that in windows phone 7 ? The format of JSON is below:

{"access_token":"j2hkjb4fgwt54gfdsfs"}

How to retrieve the JSON and store "j2hkjb4fgwt54gfdsfs" to a string variable ?

Thanks in advance

Upvotes: 0

Views: 437

Answers (2)

Brian Reischl
Brian Reischl

Reputation: 7356

You really have two questions here:

  1. How do you get the data from Foursquare?
  2. How do you parse the data once you have it?

There are many different ways to accomplish each of those.

Retrieving data could be done with HttpWebRequest, WebClient, or any number of 3rd party libraries such as RestSharp.

Parsing the data could be done with JSON.Net (as spender mentioned), DataContractJsonSerializer, or probably any number of other libraries.

Upvotes: 1

spender
spender

Reputation: 120450

How about using Json.net? Then you'd do something like

JObject.Parse(jsonString)["access_token"].Value<string>()

Upvotes: 2

Related Questions