Skip to content

Instantly share code, notes, and snippets.

@leandrocustodio
Created March 11, 2013 20:10
Show Gist options
  • Save leandrocustodio/5137295 to your computer and use it in GitHub Desktop.
Save leandrocustodio/5137295 to your computer and use it in GitHub Desktop.
Carregar um JSON no C#
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