var a = JSON.Deserialize<object>(e.ExtraParams["address"]);
的JSONASP.NET - JSON鑄造
[{"id":"","country":"MYcOUNTRY","city":"citycitycity","street":"street","block":"house","building":"building","additionalInfo":"fdsfdsfdsfds","latitude":"32.9206000","longitude":"35.1003000"}]
以及用於存儲有關地址
[Serializable]
class BEAddress{
public string Id { get; set; }
public string Country { get; set; }
public string City { get; set; }
public string Street { get; set; }
public string Block { get; set; }
public string Building { get; set; }
public string Latitude { get; set; }
public string Longitude { get; set; }
public string AdditionalInfo { get; set; }
}
我不能精明怎麼投對象a
到BEAddress
信息類?
UPDATE: 的方式我seriliaze這個數據
<script type="text/javascript">
var <%=ClientID%>_getAddress = function() {
var jsonObj = [];
jsonObj.push({
Id: <%=AddressIdHdn.ClientID%>.getValue(),
Country: <%=cmbCountries.ClientID%> .getRawValue(),
City: <%=cmbCities.ClientID%> .getRawValue(),
Street: <%=txtStreet.ClientID%> .getValue(),
Block: <%=txtBlock.ClientID%> .getValue(),
Building: <%=txtBuilding.ClientID%> .getValue(),
AdditionalInfo: <%=txtAdditionalInfo.ClientID%> .getValue(),
Latitude: <%=txtLatitude.ClientID%> .getValue(),
Longitude: <%=txtLongitude.ClientID%> .getValue()
});
return jsonObj;
}
</script>
時發生的錯誤「不能反序列化JSON數組類型‘Loginet.Entities.BEAddress’」。 – Alexandre
唯一突出的是你的類擁有用大寫字母定義的屬性,而你的JSON全部是小寫字母。看看我是如何做到這一點的,然後才需要比賽。出於興趣,這是與Ext.NET? – dougajmcdonald
是的,它是ext.net。錯誤是一樣的。 json的結果是:[{「id」:「」,「country」:「Израиль」,「city」:「Гэдера」,「street」:「street」,「block」:「house」,「building」: 「building」,「additionalInfo」:「fdsfdsfdsfds」,「緯度」:「32.9206000」,「經度」:「35.1003000」}]' – Alexandre