2014-04-28 2 views
-2

다음은 내가 json 문자열 C#에서 JSON에서 값을 가져

당신은 어떤 생각이 저를 공유하는 경우

.... 주어진

{"Response":{"MetaInfo":{"Timestamp":"2014-04-28T11:55:00.689+0000"},"View":  
[{"_type":"SearchResultsViewType","ViewId":0,"Result":[{"Relevance":1.0,"Location": 
{"LocationType":"point","Name":"22.32963 73.24493","DisplayPosition":  
{"Latitude":22.3296299,"Longitude":73.244923},"MapView":{"TopLeft": 
{"Latitude":22.3386231,"Longitude":73.2352007},"BottomRight": 
{"Latitude":22.3206367,"Longitude":73.2546453}},"Address":{"AdditionalData":[]}}}, 
{"Relevance":1.0,"Distance":32.4,"MatchLevel":"street","MatchQuality": 
{"Country":1.0,"State":1.0,"County":1.0,"City":1.0,"District":1.0,"PostalCode":1.0},"Location": 
{"LocationId":"LINK_939680173_L","LocationType":"point","DisplayPosition": 
{"Latitude":22.3296022,"Longitude":73.2452373},"MapView":{"TopLeft": 
{"Latitude":22.33396,"Longitude":73.24433},"BottomRight": 
{"Latitude":22.3287,"Longitude":73.24571}},"Address":`****`{"Label":"Harini,`****` Vadodara 390022, India","Country":"IND","State":"GJ","County":"Vadodara","City":"Vadodara","District":"Harini","PostalCode":"390022","AdditionalData":[{"value":"India","key":"CountryName"},{"value":"Gujarat","key":"StateName"}]}}}]}]}} 
+0

를 사용하여 라벨을 참조 할 수 있습니다 당신은 지금까지 * * 아무것도를 시도 ? Json.NET? DataContractJsonSerializer? –

답변

3

다운로드 Newtonsoft의 JSON의 DLL에서 Label 키 값을 원하는 json 문자열입니다.

다음 JsonConvert.DeserializeObject 또는 JsonConvert.SerializeObject

UPDATE 사용할 수 있습니다 : Visual Studio를 여기에

http://www.nuget.org/packages/newtonsoft.json/

에 대한 nuget 통해 설치에 대한 다음 있는 지침을 사용하는 방법에 대한 예입니다 그것. 귀하의 경우를 들어

string json = @"{ 
'Name': 'Bad Boys', 
'ReleaseDate': '1995-4-7T00:00:00', 
'Genres': [ 
    'Action', 
    'Comedy' 
    ] 
}"; 

Movie m = JsonConvert.DeserializeObject<Movie>(json); 

string name = m.Name; 

단지 (각 값에 대해) 당신의 JSON 문자열 객체를 생성하고 deserializeObject를 호출 할 때 다음 MyObject.label

관련 문제