我有一个JSON文件,其中的一个属性是:
"Location": {
"Latitude": 38.7080404,
"Longitude": -9.1436747
}
我有一些带有Location属性的类:
public class Example {
public IPoint Location { get; set; }
}
可以如下创建一个IPoint:
Example example = new Example();
example.Location = new Point(new Coordinate(latitude, longitude)) { SRID = 4326 };
如何定义Newtonsoft JSon.Net规则以将JSON转换为IPoint类型的任何属性?