I have the following code which prints out json to my page
http://screencast.com/t/ASe6sUW64R1
the code is as follows
public async Task<ActionResult> TestRestCall()
{
Uri serviceRoot = new Uri(azureAdGraphApiEndPoint);
var token = await GetAppTokenAsync();
string requestUrl = "https://graph.windows.net/mysaasapp.onmicrosoft.com/users?api-version=2013-04-05";
HttpClient hc = new HttpClient();
hc.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue(
"Bearer", token);
HttpResponseMessage hrm = await hc.GetAsync(new Uri(requestUrl));
if (hrm.IsSuccessStatusCode)
{
ViewBag.Message = JObject.Parse(await hrm.Content.ReadAsStringAsync()).ToString(Formatting.Indented) ;
return View();
}
else
{
return View();
}
}
However for debugging purposes, I would like to show the JSON nicely to read it better, but code is not working as I found in another SO answer