하여 JSON 문자열을 얻고이 WebSite 설정은, 당신을 위해 클래스 객체를 생성합니다이 웹 사이트는이 객체를 가지고 프로젝트에 넣어.
예 :
public class RootObject // object name
{
//atributtes names
public string Vorname { get; set; }
public string AusweisNr { get; set; }
public string MitgliedsNr { get; set; }
public string returnstr { get; set; }
public string returncode { get; set; }
}
그래서이 JSON을 dowloand 및 문자열 VAR에 예를 넣어 것입니다 :
var Apiurl = "http://youAPI.com/something/something/";
var JSONString= new System.Net.WebClient().DownloadString(Apiurl);//this will download all text what the Apiurl return
그 후, 당신은/변환 넣어하는 객체에 JsonString 역 직렬화.
RootObject objectJSON = JsonConvert.DeserializeObject<RootObject>(JSONString);
마지막 코드에서 무슨 일이 발생합니까?
yourJsonObject nameForThisObject = JsonConvert.DeserializeObject<yourObjectJsonClass>(yourJsonString);
참고 : ObjectJsonClass (내 RootObject)는 SAMES JSON의 속성이 있어야합니다.
무엇으로 변환 하시겠습니까? –
질문 제목에 해시 태그를 사용하지 마십시오. – Stijn
안녕하세요. 필립. Welcome to Stackoverflow. 여기에 좋은 SO 질문을 작성하는 방법을 읽어보십시오. http : // stackoverflow.com/help/how-to-ask – garfbradaz