You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
According to Jsondiffpatch those two objects are differents:
{ temperature = 10.0 } and { temperature = 10 }
But according to json standards, those two objects should be the same because temperatures have the same value, and json standards does not differentiate float types and integer types.
However Json.net differentiate float types and integer types, and JValues are different if their types are different. In Jvalue.cs:
And Jsondiffpatch compares values based on the JValue.ValuesEquals function.
As a result, if I write a document { temperature = 0.0 } in CosmosDB, I retrieve a document { temperature = 0 } that Jsondiffpatch considers as different.
I asked ComosDb support and they responsded: The JSON type system as per standard does not have two separate types for integers and floating point numbers, and these values are considered equivalent by our system.
If you want to preserve the text representation as is, you can encode this property as a string i.e. with quotes, but note for example that the string ordering rules will apply if you try to do queries with filters over this property using operators such as < or >.
The text was updated successfully, but these errors were encountered:
The JSON spec is somewhat ambiguous on this topic. You can always write your own JsonConverter to customize how JSON.Net handles these types to suit your needs and should allow this library to work for you.
According to Jsondiffpatch those two objects are differents:
{ temperature = 10.0 } and { temperature = 10 }
But according to json standards, those two objects should be the same because temperatures have the same value, and json standards does not differentiate float types and integer types.
However Json.net differentiate float types and integer types, and JValues are different if their types are different. In Jvalue.cs:
And Jsondiffpatch compares values based on the JValue.ValuesEquals function.
As a result, if I write a document { temperature = 0.0 } in CosmosDB, I retrieve a document { temperature = 0 } that Jsondiffpatch considers as different.
I asked ComosDb support and they responsded:
The JSON type system as per standard does not have two separate types for integers and floating point numbers, and these values are considered equivalent by our system.
If you want to preserve the text representation as is, you can encode this property as a string i.e. with quotes, but note for example that the string ordering rules will apply if you try to do queries with filters over this property using operators such as < or >.
The text was updated successfully, but these errors were encountered: