이 JSON 고려 : WP7에서 JSON 데이터를 얻을하는 방법
밀접 다음 ..resourceSets: [
{
estimatedTotal: 5,
resources: [
{
__type: "Location:http://schemas.microsoft.com/search/local/ws/rest/v1",
bbox: [
51.3014406,
-8.3233626,
51.3037489,
-8.3182203
],
name: "Some Address",
point: {
type: "Point",
coordinates: [
51.3033847,
-2.3204335
]
},
address: {
addressLine: "SomeAddress",
adminDistrict: "MI",
adminDistrict2: "South Country",
countryRegion: "England",
formattedAddress: "Some Formattedaddress",
locality: "Derby",
postalCode: "12345"
},
등이 : http://blog.clauskonrad.net/2010/11/wp7-how-to-consume-json-data-from.html이
내 클래스는 다음과 같습니다
[DataContract]
public class ReturnedDetails
{
[DataMember(Name="formattedAddress")]
public string formattedAddress { get; set; }
}
그리고 이벤트 코드 :
내가 디버깅 및ser
위에 마우스를 올려 때
내가 이것을 실행, InvalidCastException
는 KnownDataContracts
가 을 '식을 계산할 수 없습니다'와 '널 (null)'이며, ReturnedDetails[] obj = (ReturnedDetails[])ser.ReadObject(ms);
에서 발생합니다.
JSON의 formattedAddress에서 가치를 얻고 싶다면 누구나 어떻게 알 수 있습니까?
도움 주셔서 감사합니다.
스택 추적 :
System.Net.WebClient에서 System.Net.WebClient.OnDownloadStringCompleted (DownloadStringCompletedEventArgs E)에서 PhoneApp1.MainPage.wc_DownloadStringCompleted (개체 송신자 DownloadStringCompletedEventArgs E)에서. DownloadStringOperationCompleted 파라미터 개체 System.Reflection.RuntimeMethodInfo.InternalInvoke (RuntimeMethodInfo rtmi 오브젝트 OBJ, BindingFlags의 invokeAttr 바인더 바인더에서 (오브젝트 ARG)은 CultureInfo 배양 부울 isBinderDefault, ASSEM BLY 호출자 System.Reflection.RuntimeMethodInfo.InternalInvoke에서 부울 verifyAccess, StackCrawlMark & stackMark) (객체 (OBJ), BindingFlags의 invokeAttr 바인더 바인더 [] 파라미터 은 CultureInfo 문화 하는 System.Reflection에서 StackCrawlMark &을 stackMark) 개체. MethodBase.Invoke] System.Delegate.DynamicInvoke (물체에서 System.Delegate.DynamicInvokeOne에서
(개체 []에 args) System.MulticastDelegate.DynamicInvokeImpl ([] 오브젝트 인수) (오브젝트 OBJ [] 파라미터 개체) args) 에서 System.Windows.Threading.DispatcherOperation.Invoke() 에서 System.Windows.Threading.Dispatcher.Dispatch (DispatcherPrio System.Windows.Hosting.CallbackCookie.Invoke에서 System.Windows.Threading.Dispatcher.OnInvoke (개체 컨텍스트)에 RITY 우선 순위) (오브젝트 [] System.Windows.Hosting.DelegateWrapper.InternalInvoke (물체 인수) ] 인수) System.Windows.RuntimeHost.ManagedHost.InvokeDelegate ( 을 IntPtr pHandle에, INT32 nParamCount, ScriptParam [] pParams, ScriptParam & pResult)