解析以下JSON字符串时,x坐标的浮点值将被更改。
{ "spatialReference" : { "wkid" : 4326 }, "candidates" : [ { "address" : "240000001", "location" : { "x" : -79.939219121531494, "y" : 40.852153506889806 }, "score" : 100, "attributes" : { } } ]}
在前面的xml上调用JObject.Parse后,它将被转换为
{ "spatialReference": { "wkid": 4326 }, "candidates": [ { "address": "240000001", "location": { "x": -79.9392191215315, "y": 40.852153506889806 }, "score": 100, "attributes": {} } ] }
有没有办法强制解析器将x / y值视为字符串并保持更高的精度?
答案 0 :(得分:3)
如果反序列化为x和y属性为小数的强类型对象,则不会丢失任何精度。