简体   繁体   English

OData库将Edm.Single序列化为数字

[英]OData Library serializes Edm.Single as number

According to the specification (and the odata.org summary ) Edm.Single (and Edm.Double) are represented 'as a JSON string' (ie surrounded by double quotes). 根据规范(和odata.org摘要 ),Edm.Single(和Edm.Double)被表示为“ JSON字符串”(即用双引号引起来)。 However the OData Library serializes Edm.Single (I haven't verified that Edm.Double has the same behavior) as number (ie unquoted). 但是,OData库将Edm.Single(我尚未验证Edm.Double具有相同的行为)序列化为数字(即未引用)。 Is this a problem with the library - or the spec? 库或规范有问题吗?

This looks like a bug in the spec (both the MS-ODATA as well as the odata.org). 这看起来像是规范中的错误(包括MS-ODATA和odata.org)。 I verified that the product (both OData Library and WCF DS) read and write these values as un-quoted, since double can fit into JSON's number just fine. 我验证了该产品(OData库和WCF DS都)将这些值读写为未引号,因为double可以很好地适合JSON的数字。 (Note that one exception of NaN and Inf which are quoted). (请注意,引用的NaN和Inf是一种例外)。 (I'll see what we can do about fixing the spec :-)) (我会看到我们可以如何解决该规范:-))

It is likely a problem with the odata.org summary. odata.org摘要可能存在问题。

If in doubt you should check out the more canonical documentation for the [format][1]: http://msdn.microsoft.com/en-us/library/dd541188(v=PROT.10).aspx 如有疑问,您应该查看[格式] [1]的更多规范文档: http : //msdn.microsoft.com/zh-cn/library/dd541188(v=PROT.10).aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM