r @ "NETFramework \ v4.0 \ Hồ sơ \ Khách hàng \ System.Runtime.Serialization.dll"
open System.Runtime.Serialization
open System.Runtime.Serialization.Json
[<DataContract>]
type geo = {
[<field: DataMember(Name = "type")>]
t:string
[<field: DataMember(Name = "coordinates")>]
coordinates:string
}
let decode (s:string) =
let json = new DataContractJsonSerializer(typeof<geo>)
let byteArray = Encoding.UTF8.GetBytes(s)
let stream = new MemoryStream(byteArray)
json.ReadObject(stream) :?> geo
let tw = {"type":"Point","coordinates":[-7.002648,110.449961]}
decode tw
này trả -> End yếu tố 'phối' từ không gian tên '' dự kiến . Đã tìm thấy phần tử 'item' từ không gian tên ''Json phân tích F #
Làm cách nào để xác định tọa độ DataMember để nó hiểu?
Thanks a lot
cám ơn vì cái này – jlezard