2014-03-06 125 views
0

我正在尝试跟踪,但是我在响应中获取的json格式不正确。所以我想用一些东西来替换它,使其成为正确的格式。 我想将返回的json数据存储在某个字符串变量中。注:我想存储JSON,因为它是,我不想反序列化它。有没有办法做到这一点? 这是跟踪链接在变量中存储json

http://open.mapquestapi.com/nominatim/v1/reverse.php?format=json&json_callback=renderExampleThreeResults&lat=30.718263&lon=76.694216

回答

2

只需保存在字符串响应任何你想要的:

var client = new HttpClient(); 
HttpResponseMessage response = await client.GetAsync("http://open.mapquestapi.com/nominatim/v1/reverse.php?format=json&json_callback=renderExampleThreeResults&lat=30.718263&lon=76.694216"); 
response.EnsureSuccessStatusCode(); 
string jsonValue = await response.Content.ReadAsStringAsync(); 

在jsonValue变量你有JSON。