내 앱 중 하나에서 웹 요청으로부터 응답을받습니다. 이 서비스는 RESTful 서비스이며, 아래의 JSON 형식과 유사한 결과를 반환합니다HttpwebResponse json response, C#
byte[] bytes = Encoding.GetEncoding(contentEncoding).GetBytes(contents.ToString());
request.ContentLength = bytes.Length;
using (var requestStream = request.GetRequestStream()) {
requestStream.Write(bytes, 0, bytes.Length);
using (var twitpicResponse = (HttpWebResponse)request.GetResponse()) {
using (var reader = new StreamReader(twitpicResponse.GetResponseStream())) {
//What should I do here?
}
}
}
가 어떻게 응답을 읽을 수 있습니다 : 여기
{
"id" : "1lad07",
"text" : "test",
"url" : "http:\/\/twitpic.com\/1lacuz",
"width" : 220,
"height" : 84,
"size" : 8722,
"type" : "png",
"timestamp" : "Wed, 05 May 2010 16:11:48 +0000",
"user" : {
"id" : 12345,
"screen_name" : "twitpicuser"
}
}
와 내 현재 코드는? 나는 url과 username을 원한다.
Restsharp를 통해 휴식 서비스 요청을 확인하는 것이 좋습니다. https://github.com/johnsheehan/RestSharp/wiki/Getting-Started를 통해 삶의 질을 100,000x로 쉽게 낮출 수 있습니다. 디코딩 할 오브젝트 모델. 답장을 보내 주셔서 감사합니다. – anthonyvscode