UnmarshalExtJSON cannot decode null into a string type

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Works as Designed
    • Priority: Major - P3
    • None
    • Affects Version/s: No Release
    • Component/s: BSON
    • None
    • Environment:
      go 1.11.1
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      type User struct {
          B string `bson:"b"`
          C string `bson:"c,omitempty"` 
      }
      
      func Test_UnmarshalB(t *testing.T) {
           payload := `{"c": null, "b": "b"}`
           internal := User{}
           err := bson.UnmarshalExtJSON([]byte(payload), false, &internal)
           t.Errorf("%#v %v", internal, err)
      }
      

      >>>   mgdbugs.User{B:"", C:""} cannot decode null into a string type

            Assignee:
            Unassigned
            Reporter:
            exfly
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: