Skip to content

Instantly share code, notes, and snippets.

@Godoy
Forked from leandrocustodio/gist:5137295
Last active December 14, 2015 19:29
Show Gist options
  • Save Godoy/5137345 to your computer and use it in GitHub Desktop.
Save Godoy/5137345 to your computer and use it in GitHub Desktop.
Carregar Json de uma URL externa (facebook, twitter...)
string recebeJSON = "";
using (var client = new WebClient())
{
recebeJSON = client.DownloadString("URL do JSON");
}
//transforma a string em objeto
JObject _recebeJSON = JObject.Parse(recebeJSON);
//converte o objeto para que seja acesso atravez de indíces
JToken ObjetoJSON = _recebeJSON;
/*
* Para acessar os objetos do JSON carregado, basta acessar os indíces gerados
* no objeto JSON
*/
ObjetoJSON["ID"];
ObjetoJSON["nome"];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment