Hello,
#r@"\.NETFramework\v4.0\Profile\Client\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
This returns -> End element 'coordinates' from namespace '' expected. Found element 'item' from namespace ''
How can I define the DataMember coordinates so that it understands ?
Thanks a lot