GeoJson serializers should coerce numeric values to double during deserialization

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Done
    • Priority: Major - P3
    • 1.8.3
    • Affects Version/s: 1.8.2
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      The serializers for GeoJson objects are too strict when deserializing and require that numeric values be doubles. They should allow other numeric formats (Int32 and Int64) and convert to double.

      For example, given the following class.

      public class C
      {
          public ObjectId Id { get; set; }
          public GeoJson2DCoordinates Pos { get; set; }
      }
      

      the following works:

      var c = BsonSerializer.Deserialize<C>("{ Pos : [1.0, 2.0] }");
      

      but the following does not:

      var d = BsonSerializer.Deserialize<C>("{ Pos : [1, 2] }");
      

              Assignee:
              Robert Stam
              Reporter:
              Robert Stam
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: